From a6ae6b20953c195d2201da8454a236eab53c8676 Mon Sep 17 00:00:00 2001 From: clearml <> Date: Sun, 26 Jan 2025 23:07:09 +0200 Subject: [PATCH] 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` --- clearml_agent/helper/package/base.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clearml_agent/helper/package/base.py b/clearml_agent/helper/package/base.py index caf8e99..1c33e19 100644 --- a/clearml_agent/helper/package/base.py +++ b/clearml_agent/helper/package/base.py @@ -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)