Vince Patron
by Vince Patron

Categories

Tags

I got this error trying to install Python pip on a fresh Ubuntu 16.04 install. Turns out pip 10.0 installs itself to ~/.local/bin instead of the typical location of /usr/bin/pip and it can’t find other modules it needs.

Error Upgrading Python pip on Ubuntu 16.04

It happened after I followed pip’s open suggestion to upgrade itself. The upgrade command it said was:

pip install pip --user --upgrade

Running pip after this just returns this error. There’s a very long discussion at https://github.com/pypa/pip/issues/5240

Quick Fix: Revert to previous pip version and remove ./local/bin/pip

My quick fix was simply to downgrade back to pip 8.0. Not the ideal solution but sometimes you have to get your system up and running and fix it the right way later!

Remove pip:

python -m pip uninstall pip

This should give these results:

Uninstalling pip-10.0.1:
  Would remove:
    /home/vince/.local/lib/python2.7/site-packages/pip-10.0.1.dist-info/*
    /home/vince/.local/lib/python2.7/site-packages/pip/*
Proceed (y/n)? y
  Successfully uninstalled pip-10.0.1

You can also remove the executables it created in case it didn’t completely remove it:

rm ~/.local/bin/pip
rm ~/.local/bin/pip2
rm ~/.local/bin/pip2.7

Once pip was removed, install it again as part of the base installation by using sudo:

sudo apt-get install python-pip

At this point, you will keep getting the message below but just ignore it for now.

You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Do not upgrade pip until a better way is found to properly fix this issue.

Reference