broken easy_install and pip after upgrading to OS X Mavericks

qualia365 picture qualia365 · Jan 16, 2014 · Viewed 10.1k times · Source

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?

Answer

kylemclaren picture kylemclaren · Feb 13, 2014
  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