Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python pip broken after OS X 10.8 upgrade

Tags:

python

macos

pip

Made the upgrade to Mac OS X 10.8 (Mountain Lion) and get now the following error when trying to call $ pip:

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.1

Update: Tried to reinstall by doing the install procedure again (with http://www.pip-installer.org/en/latest/installing.html#using-the-installer and easy_install), but didn't work, got the same error.

Tried now the following: Calling $ sudo pip and the above error disappears. Strange is, that the directories which could not befound in the above error message point to /System/Library/... while the python installation is (new ?) to find in /Library/Frameworks/..:

$ which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python

Any idea how to get rid of the sudo?

like image 537
geo_so Avatar asked Jul 28 '12 20:07

geo_so


People also ask

Why pip is not working in Python?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

Does upgrading pip upgrade Python?

Many users question exactly just how to upgrade to the latest version of PIP, given the ever-evolving and fast-moving python ecosystem. The short answer is, pip is just like any other PyPI package and you can upgrade it to newer (or downgrade to older) versions, just as you would upgrade or downgrade any other package.

Why pip is not working in Terminal Mac?

Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.


3 Answers

Use easy_install to update your pip to the latest version:

sudo easy_install -U pip

Also make sure you have the lastest XCode installed (ver 4.4) with Command Line Tools.

like image 66
clwen Avatar answered Oct 08 '22 02:10

clwen


This works for me

rm -f /usr/local/bin/easy_install
brew reinstall python
pip install --upgrade setuptools
pip install --upgrade pip
like image 10
Thi Avatar answered Oct 08 '22 04:10

Thi


I had a similar error except that sudo pip did not work either. I am using a "brew" installation of python (which is symlinked to /usr/local/bin) and found that the problem was that the shebangs in the pip and easy_install files were hardcoded to #!/usr/bin/python instead of #!/usr/local/bin/python, and so was using the system python version instead of the brew version.

Cheers, Tom

like image 5
Tom Close Avatar answered Oct 08 '22 04:10

Tom Close