[SciPy-user] OS X install success! + Question

Zachary Pincus zachary.pincus@yale....
Wed Jul 30 08:57:07 CDT 2008

Hi Robert,

I'm sure others with a little deeper knowledge of easy_install and  
friends may chime in, but this should get you started.

> Before installing NumPy & SciPy I installed the OS X Python from
> python.org.  That's 2.5.2 (laptop shipped with 2.5.1) and was
> installed in
> /Library/Frameworks/Python.framework/Versions/Current/bin/python
> which is just a link to
> /Library/Frameworks/Python.framework/Versions/2.5/bin/python.
> numpy and scipy installed in /Library/Frameworks/Python.framework/
> Versions/2.5/lib/python2.5/site-packages/
> So far so good.  But, when I used easy_install for nose, that got
> installed into
> /Library/Python/2.5/site-packages/.
> What is the best way to deal with the Frameworks vs no Frameworks
> thing?  Should I just put a link from /Library/Python/2.5 to /Library/
> Frameworks/Python.framework/Versions/2.5/lib/python2.5?

Short answer: the version of easy_install on your machine is for the  
version of python that came with the operating system. So  
"easy_install nose" installed nose for that version -- not for the  
python.org python that you just installed.

You will need to install easy_install for the new version of python  
that you just installed from python.org:

Then run that version of easy_install that gets installed by the  
ez_setup script. That version, for better or worse, lives by default in:

(I would recommend making a symlink to /usr/local/bin for ease.  
Alternately, you could run the easy_setup.py script with the --script- 
dir=/usr/local/bin option.)

Background information:
Apple ships a version of Python with OS X, and some housekeeping  
scripts, etc., depend on this python and in some cases, the specific  
(old or broken) versions of some of the libraries it comes with (e.g.  
numpy). This is installed in:

This version of python is accessible as /usr/bin/python, which is a  
symlink to

The basic consensus is that one really shouldn't be mucking with this  
python, so the best bet is to install the python.org python, which  
goes into /Library and /usr/local/bin.

Now, what's the deal with /Library/Python/2.5/site-packages? Well,  
Apple's basic decree is that you must not alter things in /System/...  
directories. But installing a new library for the system python would  
do just that, under the default regime (which would put them in
site-packages )
So Apple's python instead puts new libraries in /Library/Python/2.5/ 
site-packages .

This is all fine, and controlled by the default values of the sys.path  
variable (which is the list of directories Python searches when you  
try to import something). It's illuminating to do:
import sys; print sys.path
in both the system and python.org versions of python.

Now, how does one deal with multiple versions of python when  
installing things? In the pre-easy_install era, it was quite simple.  
Python things are installed with setup.py files in a directory:

python setup.py install

would install whatever library for the version of python that was used  
to run the script. So /usr/bin/python setup.py install would install  
the library for the system python, and /usr/local/bin/python setup.py  
install would do so for the python.org version. (Plain 'python' is  
the /usr/local/bin version, thanks to the python.org installer.

With easy_install, this sort of transparency is a bit lost. You need  
to look to see which version of python is invoked in the first line of  
that script to determine where the files will eventually go. If you  
have two versions of python, you need two versions of easy_install in  
different places. I personally find this a bit frustrating...


More information about the SciPy-user mailing list