Tag Archive for 'python'

Install Python 2.6 with iPython, Numpy, Scipy, Matplotlib on Leopard 10.5

I’ve been through this a few times, sometimes someone else makes it easy, sometimes not. This is somewhere between the two…

  • Get python 2.6 from here and install it. Since I already have a link through to the /System python from /Library/Frameworks/Python.framework it goes in /System/Library/Frameworks/Python.framework/Versions/2.6
  • Get numpy for python 2.6 from here and install it. It goes in /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
  • Get scipy for python 2.6 from here and install it. It goes in the same place.
  • Get freetype2 and libpng using fink. These are needed to build matplotlib. You could always try building matplotlib first to see if it works.
  • Get matplotlib from here. There wasn’t a binary for 10.5 when I looked so I had to build it, thus the above step.
  • Build and install matplotlib with the command “python2.6 setup.py build” and then “sudo python2.6 setup.py install”
  • Get easy_install from here, instructions are on the same page. You’ll have to chmod the egg to be executable. This program is great for installing other packages, it’s in the location used below.
  • Install ipython using easy_install with “sudo /Library/Frameworks/Python.framework/Versions/Current/bin/easy_install-2.6 ipython”, it’s in the same place as the easy_install program.

That got me sorted for these packages, however if you wanted to test your installs or numpy and scipy [using numpy.test() and scipy.test()] you need nose, which you can also get with easy_install. You may also want to modify your path or create links to the executables so you don’t have to write the full path into the Framework bin directory.

Since I use python for astronomy I also installed a bunch of other modules including pyFITS, pywcs, vo, and APLpy. Most were found from links on the APLpy website with commands like “sudo /usr/local/bin/python2.6 setup.py install” and APLpy itself with easy_install.

Installing PIL (python imaging library) was a bit trickier, since you need to get the libjpeg and freetype2 libraries (I got them with Fink) first. When you try and build it it’ll likely give errors because the gcc commands include –arch ppc. That can be avoided by executing “export ARCHFLAGS=”-arch i386″ before you build. Also, the selftest craps out, but doesn’t mean that the build didn’t work.

Good luck. I’m not an expert but I find it handy when I find lists like this…