Skip to content
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
2 changes: 1 addition & 1 deletion kubeflow/trainer/backends/container/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def build_pip_install_cmd(trainer: types.CustomTrainer) -> str:
extras = " ".join(f"--extra-index-url {u}" for u in index_urls[1:])
quoted = " ".join(f'"{p}"' for p in pkgs)
return (
"PIP_DISABLE_PIP_VERSION_CHECK=1 pip install --no-warn-script-location "
"PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 pip install --no-warn-script-location "
f"--index-url {main_idx} {extras} {quoted} && "
)

Expand Down
4 changes: 2 additions & 2 deletions kubeflow/trainer/backends/kubernetes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ def get_script_for_python_packages(
LOG_FILE="{install_log_file}"
rm -f "$LOG_FILE"

if PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\
if PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if PIP_BREAK_SYSTEM_PACKAGES can break other user's deployment.
WDYT @kubeflow/kubeflow-sdk-team ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a safe default given it's only set in a container. It just means that pip doesn't complain if it tries to modify an externally-managed python. It doesn't change how pip installs the packages.

--no-warn-script-location $PIP_OPTS --user $PACKAGES >"$LOG_FILE" 2>&1; then
echo "Successfully installed Python packages: $PACKAGES"
elif PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\
elif PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\
Comment on lines +297 to +300
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag should not be added to the localprocess backend. It is not safe to install packages into the system python outside containerised environments, and it's not necessary as this backend uses a venv.

--no-warn-script-location $PIP_OPTS $PACKAGES >>"$LOG_FILE" 2>&1; then
echo "Successfully installed Python packages: $PACKAGES"
else
Expand Down
20 changes: 10 additions & 10 deletions kubeflow/trainer/backends/kubernetes/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ def test_get_resources_per_node(test_case: TestCase):
'LOG_FILE="pip_install.log"\n'
'rm -f "$LOG_FILE"\n'
"\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS --user $PACKAGES >"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS $PACKAGES >>"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"else\n"
Expand All @@ -239,10 +239,10 @@ def test_get_resources_per_node(test_case: TestCase):
'LOG_FILE="pip_install.log"\n'
'rm -f "$LOG_FILE"\n'
"\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS --user $PACKAGES >"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS $PACKAGES >>"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"else\n"
Expand Down Expand Up @@ -273,10 +273,10 @@ def test_get_resources_per_node(test_case: TestCase):
'LOG_FILE="pip_install.log"\n'
'rm -f "$LOG_FILE"\n'
"\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS --user $PACKAGES >"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS $PACKAGES >>"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"else\n"
Expand All @@ -303,10 +303,10 @@ def test_get_resources_per_node(test_case: TestCase):
'LOG_FILE="pip_install.log"\n'
'rm -f "$LOG_FILE"\n'
"\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS --user $PACKAGES >"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS $PACKAGES >>"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"else\n"
Expand Down Expand Up @@ -457,10 +457,10 @@ def test_get_script_for_python_packages(test_case):
'LOG_FILE="pip_install.log"\n'
'rm -f "$LOG_FILE"\n'
"\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"if PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS --user $PACKAGES >"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --quiet \\\n"
"elif PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_BREAK_SYSTEM_PACKAGES=1 python -m pip install --quiet \\\n"
' --no-warn-script-location $PIP_OPTS $PACKAGES >>"$LOG_FILE" 2>&1; then\n'
' echo "Successfully installed Python packages: $PACKAGES"\n'
"else\n"
Expand Down
Loading