From 8dac135cb89fa5d27d7af344703db0a20cf550e1 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 11 Aug 2021 14:56:05 +1000 Subject: [PATCH] Simplify pip install The uninstall here has been around since Ibb4b42119dc2e51577c77bbbbffb110863e5324d. At the time, there might have been conflicts between packaged and installed pip. We don't need it today; get-pip.py keeps itself separate enough in /usr/local on all platforms. Thus we can also remove the suse/centos special-casing. python3-pip is in the RPM list so we don't need to re-install for Fedora. Add a note on why we are over-installing pip. Remove some old setuptools workarounds that are commented out. Change-Id: Ie3cb81a8ff71cf4b81e23831c380f83b0381de71 --- stack.sh | 14 +++++++++++++- tools/install_pip.sh | 22 ++-------------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/stack.sh b/stack.sh index 47d6dc718a..1aa96c9d49 100755 --- a/stack.sh +++ b/stack.sh @@ -752,7 +752,19 @@ git_clone $REQUIREMENTS_REPO $REQUIREMENTS_DIR $REQUIREMENTS_BRANCH echo_summary "Installing package prerequisites" source $TOP_DIR/tools/install_prereqs.sh -# Configure an appropriate Python environment +# Configure an appropriate Python environment. +# +# NOTE(ianw) 2021-08-11 : We install the latest pip here because pip +# is very active and changes are not generally reflected in the LTS +# distros. This often involves important things like dependency or +# conflict resolution, and has often been required because the +# complicated constraints etc. used by openstack have tickled bugs in +# distro versions of pip. We want to find these problems as they +# happen, rather than years later when we try to update our LTS +# distro. Whilst it is clear that global installations of upstream +# pip are less and less common, with virtualenv's being the general +# approach now; there are a lot of devstack plugins that assume a +# global install environment. if [[ "$OFFLINE" != "True" ]]; then PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh fi diff --git a/tools/install_pip.sh b/tools/install_pip.sh index 7ecea4e821..a80c178f2a 100755 --- a/tools/install_pip.sh +++ b/tools/install_pip.sh @@ -111,14 +111,6 @@ function configure_pypi_alternative_url { } -# Setuptools 8 implements PEP 440, and 8.0.4 adds a warning triggered any time -# pkg_resources inspects the list of installed Python packages if there are -# non-compliant version numbers in the egg-info (for example, from distro -# system packaged Python libraries). This is off by default after 8.2 but can -# be enabled by uncommenting the lines below. -#PYTHONWARNINGS=$PYTHONWARNINGS,always::RuntimeWarning:pkg_resources -#export PYTHONWARNINGS - # Show starting versions get_versions @@ -135,19 +127,9 @@ if is_fedora && [[ ${DISTRO} == f* ]]; then # installed; this *should* remain separate under /usr/local and not break # if python3-pip is later installed. # For general sanity, we just use the packaged pip. It should be - # recent enough anyway. - install_package python3-pip -elif is_fedora || is_suse; then - # Python in suse/centos depends on the python-pip package; because - # of the split "system-python" uninstalling python3-pip also - # uninstalls the user python3 package which is bad and leaves us - # without a python to use. Just install over. - install_get_pip + # recent enough anyway. This is included via rpms/general + continue else - # Remove packaged pip, and install the latest upstream. - if is_package_installed python3-pip ; then - uninstall_package python3-pip - fi install_get_pip fi