12

Upgraded to OSX Mavericks and everything broke. I have tried the "sudo easy_install pip" trick and it seems to pup pip somewhere else:

Best match: pip 1.4.1
Processing pip-1.4.1-py2.7.egg
pip 1.4.1 is already the active version in easy-install.pth
Installing pip script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing pip-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

pip throws:

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.2.1
holografix
  • 610
  • 3
  • 10
  • 24
  • possible duplicate of [pip broke. how to fix DistributionNotFound error?](http://stackoverflow.com/questions/6200056/pip-broke-how-to-fix-distributionnotfound-error) – TerryA Nov 08 '13 at 11:23
  • I had the same issue when upgrading to OS X 10.9, and the above question helped me out ^^ – TerryA Nov 08 '13 at 11:24
  • Do the posted responses answer your question? – Trein Feb 23 '14 at 16:37
  • 1
    Sorry Trein, even thought everyone was very helpful it didn't fix my issue. Downloading a patch from python's official website and re-installing it seems to have fixed it. – holografix Feb 27 '14 at 03:52

6 Answers6

23

Probably you have used easy_install to install pip and the mixture of both py package manage tools lead to the pkg_resources.DistributionNotFound problem. To fix it, run:

easy_install --upgrade pip
Trein
  • 3,658
  • 27
  • 36
1

I would highly recommend using Homebrew - http://brew.sh/ for installing Python on OSX. Pip and easy_install are setup properly and you will never have to use sudo to install any packages. That is one of the underlying principles of Homebrew that I love.

William Denman
  • 3,046
  • 32
  • 34
  • 3
    Although be aware that Homebrew will throw a fit when you're trying to install Python while `/usr/local/bin/pip` already exists. You need to remove the previously installed `pip` first. – robertklep Nov 08 '13 at 13:19
  • I've never had to do that as I always install Homebrew first on a fresh install of OSX. But very good to know. When you say 'throw a fit', does it crash? Or does it just give a warning? – William Denman Nov 08 '13 at 13:55
  • It can't complete the installation because of a previously installed `pip` not under it's control. It does suggest to remove the old version and run `brew link SOMETHING` (I believe) to complete the installation. – robertklep Nov 08 '13 at 14:38
1

After upgrading to Maverick, open Xcode. It should prompt you to re-install the necessary components of Command-Line Tools automatically.

Then use Homebrew to check: brew doctor

Will probably say CLT needs to be installed, in which case:

xcode-select --install should do it

JLev
  • 43
  • 5
1
  1. I removed pip with easy_install -m pip. You might need sudo easy_install -m pip.
  2. I deleted the egg directories from my site-packages folder.
  3. Then I did this:

    brew install openssl
    brew link openssl --force
    brew uninstall python
    brew install python --with-brewed-openssl
    

This got pip back and running as it was (re)installed with Python using Homebrew. Of course linking openssl this way means I am all-in with Homebrew on the Mac and that is fine with me!

e.thompsy
  • 1,297
  • 1
  • 15
  • 19
0

I would advise against installing brew or fink or macports only to complement or "fix" packages that you get from Apple, like Python. You end up with managing two software environments, and whenever you upgrade either of them, "interesting things" may happen.

In this particular case Trein's solution sudo easy_install --upgrade pip seems to be much simpler. Hence a +1 from me :-)

Of course these extra environments can be useful if you want to install (lots of) things you don't get from Apple. The price to pay is that subtle interactions between the Apple and non-Apple environments might cause unpleasant surprises. See the warnings in some of the comments above.

At the end of the day it boils down to personal preferences and priorities.

András Aszódi
  • 8,948
  • 5
  • 48
  • 51
0

None of your posted solutions really worked - I downloaded a patch from the official Python website which I think re-installed it and seems to have fixed it.

holografix
  • 610
  • 3
  • 10
  • 24