Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip broken after upgrading

I did pip install -U easyinstall, and then pip install -U pip to upgrade my pip. However, I get this error now when trying to use pip:

root@d8fb98fc3a66:/# which pip /usr/local/bin/pip root@d8fb98fc3a66:/# pip bash: /usr/bin/pip: No such file or directory 

This is on an ubuntu 12.04 in a docker image.

like image 637
dl8 Avatar asked Oct 10 '14 15:10

dl8


People also ask

Why isnt my pip working?

This error usually means there's a problem with the Python installation or the system variable PATH is not set up correctly. Try reinstalling Python and all its components to fix the problem. The easiest way is via the Python executable installer.

Is it safe to upgrade pip?

New software releases can bring bug fixes, new features, and faster performance. For example, NumPy 1.20 added type annotations, and improved performance by using SIMD when possible. If you're installing NumPy, you might want to install the newest version.


2 Answers

One reason can be remembed locations.

You can clear the cached locations by issuing following command:

hash -r 

SIDENOTE: Instead of which, using type command, you can see the hashed location:

$ type pip pip is /usr/local/bin/pip $ pip -V pip 1.5.6 from /usr/local/lib/python2.7/dist-packages (python 2.7) $ type pip pip is hashed (/usr/local/bin/pip) 
like image 74
falsetru Avatar answered Sep 17 '22 15:09

falsetru


If doing hash -r doesn't work, it's possible that the new pip got installed in /usr/local/bin/ instead of the old one in /usr/bin/. And it so happens that the new location is not in the list of paths searched for executables.

In that case, either fix the list of paths or copy the executables:

cp -p /usr/local/bin/pip* /usr/bin/ 

You may also hardlink the executables instead of copying them (this may ensure that future upgrades are done correctly).

like image 37
ADTC Avatar answered Sep 20 '22 15:09

ADTC