Extend upgrade.sh to automatically upgrade pip #4548

Closed
opened 2025-12-29 18:37:20 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Feb 9, 2021).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Add a step in upgrade.sh to upgrade the Python package manager (pip). E.g. pip install --upgrade pip.

Justification

When the virtual environment is created, a copy of the system pip is used. If this is out of date, it can lead to installation problems such as the one documented in #5774.

Originally created by @jeremystretch on GitHub (Feb 9, 2021). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Add a step in `upgrade.sh` to upgrade the Python package manager (pip). E.g. `pip install --upgrade pip`. ### Justification When the virtual environment is created, a copy of the system pip is used. If this is out of date, it can lead to installation problems such as the one documented in #5774.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:37:20 +01:00
adam closed this issue 2025-12-29 18:37:21 +01:00
Author
Owner

@candlerb commented on GitHub (Feb 12, 2021):

Based on report #5813 (problems with opensuse), I found a further modification is required:

--- upgrade.sh.orig	2021-02-12 14:56:01.992398949 +0000
+++ upgrade.sh	2021-02-12 14:56:49.396667022 +0000
@@ -30,16 +30,11 @@
 source "${VIRTUALENV}/bin/activate"

 # Upgrade pip
-COMMAND="pip install --upgrade pip"
+COMMAND="pip install --upgrade pip setuptools wheel"
 echo "Updating pip ($COMMAND)..."
 eval $COMMAND || exit 1
 pip -V

-# Install necessary system packages
-COMMAND="pip install wheel"
-echo "Installing Python system packages ($COMMAND)..."
-eval $COMMAND || exit 1
-
 # Install required Python packages
 COMMAND="pip install -r requirements.txt"
 echo "Installing core dependencies ($COMMAND)..."

That's from following the instructions here, and works in my test environment.

@candlerb commented on GitHub (Feb 12, 2021): Based on report #5813 (problems with opensuse), I found a further modification is required: ``` --- upgrade.sh.orig 2021-02-12 14:56:01.992398949 +0000 +++ upgrade.sh 2021-02-12 14:56:49.396667022 +0000 @@ -30,16 +30,11 @@ source "${VIRTUALENV}/bin/activate" # Upgrade pip -COMMAND="pip install --upgrade pip" +COMMAND="pip install --upgrade pip setuptools wheel" echo "Updating pip ($COMMAND)..." eval $COMMAND || exit 1 pip -V -# Install necessary system packages -COMMAND="pip install wheel" -echo "Installing Python system packages ($COMMAND)..." -eval $COMMAND || exit 1 - # Install required Python packages COMMAND="pip install -r requirements.txt" echo "Installing core dependencies ($COMMAND)..." ``` That's from following the instructions [here](https://python-packaging-user-guide.readthedocs.io/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date), and works in my test environment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4548