Fixing Broken Pip and Distribute

I had some trouble updating pip and distribute for a brew installed python. After upgrading, neither pip nor distribute would launch. After manually tweaking a few version numbers, everything was fixed. Read on for instructions.

By Matthew Malinowski, 2013-04-03


I had some problems updating distribute and pip today. Hope this helps someone out there.

I have Python installed with homebrew. In brew info python, it says:

Distribute and Pip have been installed. To update them
    pip install --upgrade distribute
    pip install --upgrade pip

Today I ran these commands, and it broke pip and easy_install, and probably other stuff too. (I think this probably happened because the account I am working in isn't an admin, but I am not too familiar with python and pip, so perhaps this is just something that happens when you upgrade stuff.)

pip install --upgrade pip upgraded pip from 1.2.1 to 1.3.1.

When I ran pip, I got this:

Traceback (most recent call last):
    File "/usr/local/bin/pip", line 5, in <module>
        from pkg_resources import load_entry_point
    File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 2809, in <module>
        parse_requirements(__requires__), Environment()
    File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 594, in resolve
        raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.2.1

pip install --upgrade pip upgraded pip in /usr/local/lib/python2.7/site-packages, but did not change the required version number in /usr/local/bin/pip and /usr/local/bin/pip-2.7.

To resolve this, I edited /usr/local/bin/pip and /usr/local/bin/pip-2.7 to include the new, correct version number for pip, 1.3.1.

pip install --upgrade distribute upgraded distribute from 0.6.28 (I think) to 0.6.35.

When I ran easy_install, I got this:

Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 2809, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 594, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.28

You guessed it, pip install --upgrade distribute upgraded distribute in /usr/local/lib/python2.7/site-packages, but did not change the required version number in /usr/local/bin/easy_install and /usr/local/bin/easy_install-2.7.

To resolve this, I edited /usr/local/bin/easy_install and /usr/local/bin/easy_install-2.7 to include the new, correct version number for distribute, 0.6.35.


Back to Blog Index...