pip broke. how to fix DistributionNotFound error?

Stephan picture Stephan · Jun 1, 2011 · Viewed 196k times · Source

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.

Answer

NewPtone picture NewPtone · Aug 3, 2012

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.