Search code examples
pythonpipsetuptoolseasy-install

Upgrading setuptools on Mountain Lion following Python upgrade


I am running Mountain Lion with Python 2.7.2 installed. In the past, I've installed virtualenv using pip install and all has worked well. However, I had some problems running several packages and so decided to upgrade Python (2.7.8) using the .dmg at python.org.

The installation installed a version of Python in /Library/Frameworks/Python.framework and I ran the Update Shell Profile.command to make this the default Python. Now when I enter 'python' at the terminal prompt, 2.7.8 starts up so all's well, so far.

In an admin account, I then upgraded setuptools using:

> curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python

This installed easy_install at /Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install (i.e. with the new default Python 2.7.8 installation). This seemed to install OK but when tried to install pip:

> sudo easy_install pip

it failed with error saying:

ImportError: cannot import name ContextualZipFile

I thought perhaps there was a different version of easy_install that was trying to run but if I explicitly run the new version of easy_install it gives the same error message:

Any suggestions why this should be happening? Some reports suggest it may be a bug introduced during an update to setuptools (but that was several updates ago and was supposed to have been fixed - but it could have been broken again, I suppose). Is there any way to install a previous version?


Solution

  • Have you tried installing pip as per http://pip.readthedocs.org/en/latest/installing.html