Skip to content

Commit

Permalink
SDK - Containers - Made python package installation more robust
Browse files Browse the repository at this point in the history
Fixes #2252
On some systems (e.g. in DL VM containers) `pip3` does not point to the same environment as `python3`.
  • Loading branch information
Ark-kun committed Oct 5, 2019
1 parent ed285ce commit 59ba646
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sdk/python/kfp/containers/_component_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def _generate_dockerfile(filename, base_image, python_version, requirement_filen
if requirement_filename is not None:
f.write('ADD ' + requirement_filename + ' /ml/requirements.txt\n')
if python_version == 'python3':
f.write('RUN pip3 install -r /ml/requirements.txt\n')
f.write('RUN python3 -m pip install -r /ml/requirements.txt\n')
else:
f.write('RUN pip install -r /ml/requirements.txt\n')
f.write('RUN python -m pip install -r /ml/requirements.txt\n')

for src_path, dst_path in (add_files or {}).items():
f.write('ADD ' + src_path + ' ' + dst_path + '\n')
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/tests/compiler/component_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_generate_dockerfile(self):
FROM gcr.io/ngao-mlpipeline-testing/tensorflow:1.10.0
RUN apt-get update -y && apt-get install --no-install-recommends -y -q python3 python3-pip python3-setuptools
ADD requirements.txt /ml/requirements.txt
RUN pip3 install -r /ml/requirements.txt
RUN python3 -m pip install -r /ml/requirements.txt
ADD main.py /ml/main.py
'''

Expand Down

0 comments on commit 59ba646

Please sign in to comment.