Fix Python – pip broke. how to fix DistributionNotFound error?

Question

Asked By – Stephan

Whenever i try to use pip I get an error. For exampple:

$ sudo pip install gevent-websocket

Traceback (most recent call last):  
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2675, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.8.1

I feel tempted to change the value of into pip==0.8.2.. but I dont feel dealing with the consequences of ‘hacking’ up my installation…
I’m running python 2.7 and pip is at version 0.8.2.

Now we will see solution for issue: pip broke. how to fix DistributionNotFound error?


Answer

I find this problem in my MacBook, the reason is because as @Stephan said, I use easy_install to install pip, and the mixture of both py package manage tools led to the pkg_resources.DistributionNotFound problem.
The resolve is:

easy_install --upgrade pip

Remember: just use one of the above tools to manage your Py packages.

This question is answered By – NewPtone

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0