Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK - Containers - Made python package installation more robust #2316

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions sdk/python/tests/compiler/component_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ 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
'''

golden_dockerfile_payload_three = '''\
FROM gcr.io/ngao-mlpipeline-testing/tensorflow:1.10.0
RUN apt-get update -y && apt-get install --no-install-recommends -y -q python python-pip python-setuptools
ADD requirements.txt /ml/requirements.txt
RUN pip install -r /ml/requirements.txt
RUN python -m pip install -r /ml/requirements.txt
ADD main.py /ml/main.py
'''
# check
Expand Down