Add initial support for --break-system-packages version detection, but the reality is that we do not need it, because by the time we are running it is too late, so we do rm /usr/lib/python3.*/EXTERNALLY-MANAGED

This commit is contained in:
clearml 2025-01-26 23:07:09 +02:00
parent 369b440b96
commit a6ae6b2095

View File

@ -22,6 +22,9 @@ class PackageManager(object):
ABC for classes providing python package management interface
"""
# # mark that we have support for the `--break-system-packages` flag that allows system install
# pip_support_break_system_packages_flag = False
_selected_manager = None
_cwd = None
_pip_version = None
@ -127,6 +130,17 @@ class PackageManager(object):
if pip_pkg:
MarkerRequirement.pip_new_version = SimpleVersion.compare_versions(pip_pkg.version, ">=", "20")
# # actually this is not really needed,
# # because if we got here, someone already installed us system-wide
# # but we will store it anyhow, for future use
# self.pip_support_break_system_packages_flag = (
# SimpleVersion.compare_versions(pip_pkg.version, ">=", "23.0.1"))
# # this is too late for this flag because from now on we are in venv
# if self.pip_support_break_system_packages_flag:
# print("INFO: Using `--break-system-packages to` allow system wide agent install")
# self.add_extra_install_flags(["--break-system-packages"])
# add --use-deprecated=legacy-resolver to pip install to avoid mismatched packages issues
self._add_legacy_resolver_flag(pip_pkg.version)