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.
I had this issue when I was using homebrew. Here is the solution from Issue #26900
On Mac OS X (MBP), the following (taken from another answer found herein) resolved my issues:
Clearly the root cause here is having a secondary method by which to install python (in my case Homebrew). Hopefully, the people responsible for the pip script can remedy this issue since its still relevant 2 years after first being reported on Stack Overflow.
The root of the problem are often outdated scripts in the
bin
(Linux) orScripts
(Windows) subdirectory. I'll explain this using problem I encountered myself as an example.I had virtualenv version 1.10 installed in my user site-packages (the fact it's in user site-packages not sytem site-packages is irrelevant here)
After I upgraded it to version 1.11 I got the following error:
File
/home/users/pdobrogost/.local/bin/virtualenv
mentioned in the error message looked like this:There, we see that
virtualenv
script was not updated and still requires previously installed version 1.10 of virtualenv.Now, reinstalling virtualenv like this
does not help (neither
pip install --user --upgrade --force-reinstall virtualenv
) because script/home/users/pdobrogost/.local/bin/virtualenv
is left unchanged.The only way I could fix this was by manually removing virtualenv* scripts from
/home/users/pdobrogost/.local/bin/
folder and installing virtualenv again. After this, newly generated scripts refer to the proper version of the package: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 thepkg_resources.DistributionNotFound
problem. The resolve is:Remember: just use one of the above tools to manage your Py packages.
If you're on CentOS make sure you have the YUM package "python-setuptools" installed
Fixed it for me.