Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11988 closed task (fixed)

Add a note to the Python pages regarding upgrading pip

Reported by: Douglas R. Reno Owned by: blfs-book
Priority: normal Milestone: 9.0
Component: BOOK Version: SVN
Severity: normal Keywords:


As of Python-2.7.16 and Python-3.7.3, an upgrade of pip (either pip2 or pip3) will overwrite the opposite set of programs. As an example, running 'pip2 --upgrade pip' will remove /usr/bin/pip3 and /usr/bin/pip3.7.

In order to fix this, the user has to run 'python3 -m pip install --force pip'. This is because pip is already listed as installed in /usr/lib/python3.7/site-packages/pip, but it isn't able to be run via standard means (you have to run python3 -m pip install <module_name>).

To overcome this, since we still have to support both python versions, I think a note should be added to both Python pages containing instructions for repairing upgrades of pip that cause problems such as this (18.0.3 ships with Python-2.7.16, and this was discovered while upgrading to 19.1 which adds the warning about Python deprecation).

TL;DR - add a note explaining to run 'python3 -m pip install --force pip' to Python3 (and a Python2-based note to Python2) in the event that pip is upgraded.

Change History (3)

comment:1 by Bruce Dubbs, 4 years ago

I was able to test this with

sudo python3 -m pip install --force pip

and everything seemed to work fine, but running

sudo python2 -m pip install --force pip

returned: You are using pip version 9.0.3, however version 19.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

'pip install --upgrade pip' did work but did delete pip3. I note that the only difference between pip2 and pip3 is the shbang line has python2 or python3 respectively.

As an aside, if I now run 'sudo python2 -m pip install --force pip', I get:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

I'll need to think about wording a bit more. Suggestions welcome.

comment:2 by Bruce Dubbs, 4 years ago

Resolution: fixed
Status: newclosed

Fixed at revision 21524.

comment:3 by Bruce Dubbs, 4 years ago

Milestone: 8.59.0

Milestone renamed

Note: See TracTickets for help on using tickets.