Thursday 11 February 2010

scipy and numpy from source, revisted

A while back I posted some instructions for getting scipy and numpy mostly up and running from current svn checkouts under python 2.6 with mac os x 10.5.8. I updated to 10.6 sometime back and have been using the preinstalled version of numpy (1.2) for my array needs without any scipy with solid results. However, I needed to get at some scipy functionality (doing some mutual information analysis via pyentropy) so I thought I'd give the process a go with the newer OS version. I'm pleased to report that everything works and was relatively easy to install/build. Basically the old instructions still hold with a couple points.

  1. It is necessary to update to a newer version of numpy, that you compile using the same fortran compiler you'll use with scipy.
  2. If you're using the build of macpython that comes with 10.6 (which is py2.6) you'll need to add the option --install-lib=/Library/Python/2.6/site-packages/ to any commands using distutil to install (eg. setup.py install)
And that's about it. I used fresh check outs of scipy (r6233, v0.8.0.dev) and numpy(r8106, v1.5.0.dev), but the same versions I've had for a while of Sparse and gFortran (the details of which are in the old post). As bonus this seems to result in less unittest failures in scipy (now only 10!) for whatever that's worth.

2 comments:

eric k said...

Howdy-

I'm working on a Django/python project for which I'd like to use the EMD (Earth mover's distance).. I noticed on http://mir-research.blogspot.com/2008/06/matlab-python-and-video.html that you ported an EMD function from MATLAB to python. Did you ever contribute it to scipy? Or, if not, is EMD currently available in python/scipy?

Thanks,
Eric

ben said...

hi eric

I never managed to get that port to a place where I liked it. The emd that I was doing I did by making a simple wrapper around Yossi Rubner's EMD library. I imagine one could make some python bindings directly around that library, that's probably the correct way to get EMD in python in light of the complexity, but I haven't done it. Hope that helps.