19

Upgraded to OS X 10.9 Mavericks and installed XCode, Command Line Tools, XQuartz, etc. Trying to run a pip install now, but it says that the distribution is not found:

Traceback (most recent call last):

  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File     "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py",     line 2603, in <module>
    working_set.require(__requires__)
  File   "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py",     line 666, in require
needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.4.1

So I tried to install pip with an easy_install. Turns out that's borked too:

Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2607, in <module>
parse_requirements(__requires__), Environment()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==1.1.6

So some of the other threads say to reinstall setuptools with a sudo python ez_setup.py. It seems to work fine:

Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg
Processing dependencies for setuptools==1.1.6
Finished processing dependencies for setuptools==1.1.6

But when running the easy_install pip, the same pkg_resources.DistributionNotFound: setuptools==1.1.6 error occurs. Anyone else have this problem? Any ideas how to fix this?

qualia365
  • 191
  • 1
  • 1
  • 4
  • The fact that you have `/usr/local/bin/easy_install` implies that you have added at least one additional Python on top of the ones Apple gave you, and you're running into the usual path confusion that always afflicts Unix novices who do that. Do you need a third-party Python? If not, do you remember where you got it from? – abarnert Jan 16 '14 at 01:36
  • Also, where did you get `setuptools` 1.1.6? IIRC, that's a few months old, and was only current for a couple days. You almost certainly want 2.1. But besides that, if an installation today is grabbing something old, that implies something funky with your caching, and probably more stuff that needs to be cleared out. – abarnert Jan 16 '14 at 01:38

3 Answers3

29
  1. Install easy_install:

    Download ez_setup.py module from https://pypi.python.org/pypi/setuptools

    $ cd path/to/ez_setup.py
    $ python ez_setup.py
    
  2. Install pip:

    $ sudo easy_install pip
    
Community
  • 1
  • 1
kylemclaren
  • 768
  • 6
  • 14
  • I got Gateway Time-out. Any ideas why ? wget http://python-distribute.org/distribute_setup.py --2014-09-19 14:47:32-- http://python-distribute.org/distribute_setup.py Resolving python-distribute.org... 88.191.140.69 Connecting to python-distribute.org|88.191.140.69|:80... connected. HTTP request sent, awaiting response... 504 Gateway Time-out 2014-09-19 14:51:33 ERROR 504: Gateway Time-out. – sparrovv Sep 19 '14 at 13:53
  • Looks to have moved or server is down, you'll have to hunt down the distribution elsewhere. – kylemclaren Sep 22 '14 at 19:44
  • 3
    this answer is potentially dangerous now, squatters took over the python-distribute.org domain and it tried delivering some questionable "Adobe Flash updates" to my machine when I went there – ashgromnies May 18 '15 at 17:43
6

try sudo python -m easy_install pip

Harry Lee
  • 992
  • 8
  • 7
4

I ran into a similar problem with git-review.

$ git review -s
Traceback (most recent call last):
  File "/usr/local/bin/git-review", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 1132, in main
    (os.path.split(sys.argv[0])[-1], get_version()))
  File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 180, in get_version
    provider = pkg_resources.get_provider(requirement)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 197, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: git-review

The git-review team said it was a bug with pkg_resources that could be fixed with

sudo pip install --upgrade setuptools

This worked fine for me.

Heath Borders
  • 30,998
  • 16
  • 147
  • 256