From f25fa3ba1b02dd988236dd24d7a9884e77acfabe Mon Sep 17 00:00:00 2001 From: Katerina Stemberova Date: Thu, 22 Feb 2024 01:33:01 +0100 Subject: [PATCH] Fixed issues during installation of dependencies on some systems * 'externally-managed-environment' error * 'Package 'libtbb2' has no installation candidate' error --- docs/source/_static/install_dependencies.sh | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/source/_static/install_dependencies.sh b/docs/source/_static/install_dependencies.sh index 39401859a..0ba1a67cc 100755 --- a/docs/source/_static/install_dependencies.sh +++ b/docs/source/_static/install_dependencies.sh @@ -144,7 +144,15 @@ elif [ -f /etc/os-release ]; then sudo apt-get install -y ${debian_pkgs_pre22_04[@]} fi - python3 -m pip install --upgrade pip + # upgrade pip depending on whether it's externally managed (i.e., by the OS), or not + echo "Upgrading pip" + # if the "EXTERNALLY-MANAGED" file exists in the Python installation's stdlib directory, + # pip needs to be upgraded using the OS means + if [ -f $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["stdlib"] + "/EXTERNALLY-MANAGED")') ]; then + sudo apt-get --only-upgrade install -y pip + else + python3 -m pip install --upgrade pip + fi # As set -e is set, retrieve the return value without exiting RET=0 @@ -174,10 +182,22 @@ elif [ -f /etc/os-release ]; then else echo "Using post-22.04 package list" - sudo apt-get install -y ${debian_pkgs_post22_04[@]} + packages_to_install=("${debian_pkgs_post22_04[@]}") + # Switching libbtbb2 to libtbbmalloc2 + packages_to_install=("${packages_to_install[@]/libtbb2/libtbbmalloc2}") + + sudo apt-get install -y ${packages_to_install[@]} fi - python3 -m pip install --upgrade pip + # upgrade pip depending on whether it's externally managed (i.e., by the OS), or not + echo "Upgrading pip" + # if the "EXTERNALLY-MANAGED" file exists in the Python installation's stdlib directory, + # pip needs to be upgraded using the OS means + if [ -f $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["stdlib"] + "/EXTERNALLY-MANAGED")') ]; then + sudo apt-get --only-upgrade install -y pip + else + python3 -m pip install --upgrade pip + fi OS_VERSION=$(lsb_release -r |cut -f2) if [ "$OS_VERSION" == "21.04" ]; then