Ubuntu – Pip upgrade not working

pippythonupgrade

I am trying to upgrade pip from version 7.1.2 to 8.0.2
But I am not able to upgrade it due to some errors. I ran the following command.

user@ubuntu:~/devstack$ pip install --upgrade pip

I am getting following Traceback errors:

Screenshot of output
Screenshot of output continue

Please let me know how can I make it work.

Best Answer

You can either upgrade pip globally using sudo:

sudo pip3 install --upgrade pip
sudo pip2 install --upgrade pip

Or you can upgrade it for your user only using the --user option:

pip3 install --upgrade --user pip
pip2 install --upgrade --user pip

Note that I upgrade both pips for Python 2 and Python 3. It's important to upgrade the version for Python 3 first, because the one you upgrade last will later be accessible through pip, which must be pip2 by default.


Important update:

As of pip version 10 (I think), the pip/pip3 command is broken, due to a change in the package structure which is not compatible with the launch scripts provided from the python-pip/python3-pip packages from apt. See Error after upgrading pip: cannot import name 'main' on Stack Overflow for details.

Quick fix: Don't run pip/pip3 any more, but instead always use python -m pip/python3 -m pip, which will not use the now incompatible executable scripts provided from your system's package manager, or don't upgrade your pip/pip3 version to 10 or higher.

Related Question