Using OS X
version 10.10.3
, pip 7.0.3
installed in /Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg
, (python 2.7)
:
Any module I try to install now returns the error pkg_resources.DistributionNotFound: ...
when trying to execute the installed module. Pip seems to install the modules successfully, although executing anything afterward results in this behavior.
$ pip install mitmproxy
Requirement already satisfied (use --upgrade to upgrade): mitmproxy in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pyperclip>=1.5.8 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>0.1.2 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): tornado>=4.0.2 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): lxml>=3.3.6 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL>=0.14 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): netlib<0.13,>=0.12 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): blinker>=1.3 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): Pillow>=2.3.0 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): urwid>=1.3 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): configargparse>=0.9.3 in /Library/Python/2.7/site-packages (from mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /Library/Python/2.7/site-packages (from tornado>=4.0.2->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): certifi in /Library/Python/2.7/site-packages (from tornado>=4.0.2->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /Library/Python/2.7/site-packages (from pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): cryptography>=0.7 in /Library/Python/2.7/site-packages (from pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): passlib>=1.6.2 in /Library/Python/2.7/site-packages (from netlib<0.13,>=0.12->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): idna in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography>=0.7->pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): cffi>=0.8 in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL>=0.14->mitmproxy)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /Library/Python/2.7/site-packages (from cffi>=0.8->cryptography>=0.7->pyOpenSSL>=0.14->mitmproxy)
Installation seems to be fine, however, executing the command results in:
$ mitmproxy
Traceback (most recent call last):
File "/usr/local/bin/mitmproxy", line 5, in <module>
from pkg_resources import load_entry_point
File "/Library/Python/2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2671, in <module>
working_set.require(__requires__)
File "/Library/Python/2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 654, in require
needed = self.resolve(parse_requirements(requirements))
File "/Library/Python/2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Pillow>=2.3.0
Another example:
$ pip install clf
Collecting clf
Downloading clf-0.5.5.tar.gz
Collecting Pygments>=1.5 (from clf)
Downloading Pygments-2.0.2-py2-none-any.whl (672kB)
100% |################################| 675kB 8.0MB/s
Collecting docopt>=0.6.0 (from clf)
Downloading docopt-0.6.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): requests>=2.3.0 in /Library/Python/2.7/site-packages (from clf)
Installing collected packages: docopt, Pygments, clf
Running setup.py install for docopt
Running setup.py install for clf
Installing clf script to /usr/local/bin
Successfully installed Pygments-2.0.2 clf-0.5.5 docopt-0.6.2
Executing the command:
$ clf osx
Traceback (most recent call last):
File "/usr/local/bin/clf", line 5, in <module>
from pkg_resources import load_entry_point
File "/Library/Python/2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2671, in <module>
working_set.require(__requires__)
File "/Library/Python/2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 654, in require
needed = self.resolve(parse_requirements(requirements))
File "/Library/Python/2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: requests>=2.3.0
I'm not sure what happened to pip
, as nothing recently changed in my environment, and pip
seemed to be working fine before.
distribute is a clue- pip 7 removed the workaround for distribute; try pip install setuptools; pip uninstall distribute.
warning: may eat your install.
Thanks for the warning — it prepared me for what was coming.
I'm not exactly sure how I fixed the problem to be quite honest, since after uninstalling distribute
both pip
and easy_install
seemed to be completely borked. I think the key thing that got pip back on track was to use the --upgrade
flag on setuptools
after reinstalling:
$ sudo pip install --upgrade setuptools
You're missing dependencies. That's why the install process hasn't been able to finalize.
sudo apt-get install libxslt-dev
sudo apt-get install libxml2-dev
sudo apt-get install libjpeg-dev
sudo pip uninstall mitmproxy
sudo pip install mitmproxy
@Ubiquitous is the issue solved ? It looks more like an issue with distribute, mitmproxy and clf than pip.
@danielgindi: it's OS X
so no apt-get
@xavfernandez yes the issue was resolved by using the method from my last comment, been running perfect since (now using 8.0.2)
Thanks!
Ran into a similar problem. El Capitan has System Integrity Protection I needed to add --user
to @Ubiquitous' solution:
sudo pip install --user --upgrade setuptools
solved it for me
You should not need sudo to install to the user site. That is a directory explicitly owned by the user.
(assuming a macOS admin account)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Thanks for the warning — it prepared me for what was coming.
I'm not exactly sure how I fixed the problem to be quite honest, since after uninstalling
distribute
bothpip
andeasy_install
seemed to be completely borked. I think the key thing that got pip back on track was to use the--upgrade
flag onsetuptools
after reinstalling: