Python easy_install confused on Mac OS X

Environment info:

$ which python
/usr/bin/python
$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin:/opt/local/bin:/Developer/Platforms/
$ which easy_install
/usr/bin/easy_install

Specifically, let's try the simplejson module (I know it's the same thing as import json in 2.6, but that isn't the point)

$ sudo easy_install simplejson
Searching for simplejson
Reading
Reading
Best match: simplejson 2.1.0
Downloading
Processing simplejson-2.1.0.tar.gz
Running simplejson-2.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Ojv_yS/simplejson-2.1.0/egg-dist-tmp-AypFWa
The required version of setuptools (>=0.6c11) is not available, and
can't be installed while this script is running. Please install a more recent version first, using 'easy_install -U setuptools'.
(Currently using setuptools 0.6c9 (/System/Library/Frameworks/))
error: Setup script exited with 2

Okay, so I'll update setuptools...

$ sudo easy_install -U setuptools
Searching for setuptools Reading
Best match: setuptools 0.6c11
Processing setuptools-0.6c11-py2.6.egg
setuptools 0.6c11 is already the
active version in easy-install.pth
Installing easy_install script to
/usr/local/bin Installing
easy_install-2.6 script to
/usr/local/bin
Using
/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools
Finished processing dependencies for
setuptools

I'm not going to speculate, but this could have been caused by any number of environment changes like the Leopard -> Snow Leopard upgrade, MacPorts or Fink updates, or multiple Google App Engine updates.

2 Answers

I followed the directions on the website below, which solved the issue for me:

Namely, download the appropriate Python version and then run:

sh ./setuptools-0.6c11-py2.7.egg

By default OSX uses /usr/bin/easy_install for third party package installs. This script is hardcoded to use a version of setuptools that is older than the version required by pymongo for python2.7 support. You can work around it like this:

$ easy_install -U setuptools
$ python -m easy_install pymongo

To upgrade do:

$ python -m easy_install -U pymongo

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like