Install Matplotlib on Snow Leopard and Leopard.

////////////////////////////////////////////////////////////
THIS WON’T WORK ANYMORE – THE CODE BELOW WILL ATTEMPT TO GET DATA THAT DOESN’T EXIST. THE AUTHOR HAS MOVED TO LION (follow the links if you have lion). IF I GET TIME I WILL TRY TO CREATE AN ALTERNATIVE
////////////////////////////////////////////////////////////

The superpack has moved to GitHub – click here to get your fix.

— see the above? do that instead —

The matplotlib superpack was/is one of the easiest ways to get a working matplotlib/numpy/scipy setup on snow leopard. Over the last few weeks the site hosting the code has gone offline! Having spent the best part of the morning attempting to install the packages and failing, only to find the script in my svn dir is annoying, however I now have everything up and running (yey me) and figured I would share the scripts.

The superpack for 10.5:

#!/bin/sh
echo 'Would you like to install gFortran (required if not already installed)? (y/n)'
read install
if  [ "$install" == "y" ] || [ "$install" == "Y" ]; then
  echo 'Downloading gFortran ...'
  curl -o gfortran-4.2.3.dmg http://www.maths.otago.ac.nz/~fonnesbeck/gfortran-4.2.3.dmg
  echo 'Installing gFortran ...'
  hdiutil mount gfortran-4.2.3.dmg
  sudo installer -pkg '/Volumes/GNU Fortran 4.2.3/gfortran.pkg' -target '/'
  hdiutil unmount '/Volumes/GNU Fortran 4.2.3'
elif [ "$install" == "n" ] || [ "$install" == "N" ]; then
  echo 'Skipping gFortran install.'
else
  echo 'Did not recognize input. Exiting'
  exit 0
fi
echo 'Downloading ez_setup ...'
curl -o ez_setup.py http://peak.telecommunity.com/dist/ez_setup.py
echo 'Installing ez_setup ...'
sudo python ez_setup.py
echo 'Installing numpy ...'
sudo easy_install http://www.maths.otago.ac.nz/~fonnesbeck/numpy-1.4.0.dev7539-py2.5-macosx-10.3-fat.egg
echo 'Installing matplotlib ...'
sudo easy_install http://www.maths.otago.ac.nz/~fonnesbeck/matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg
echo 'Installing scipy ...'
sudo easy_install http://www.maths.otago.ac.nz/~fonnesbeck/scipy-0.8.0.dev5970-py2.5-macosx-10.3-fat.egg
echo 'Installing pymc ...'
sudo easy_install http://www.maths.otago.ac.nz/~fonnesbeck/pymc-2.0_20091019-py2.5-macosx-10.3-fat.egg
echo 'Installing readline and ipython ...'
sudo easy_install readline ipython
echo 'Installing nose ...'
sudo easy_install http://www.maths.otago.ac.nz/~fonnesbeck/nose-0.11.0.dev_r0-py2.5.egg
echo 'Installing pytz ...'
sudo easy_install pytz
echo 'Installing DateUtils'
sudo easy_install DateUtils
echo 'Done'

for 10.6 see below (updated 7/01/11). For future updates see StrongInference (Chris Fonnesbeck is the guy that produces this handy little script).

#!/bin/sh
PYTHON=/usr/bin/python
SERVER=http://dl.dropbox.com/u/233041/PyMC

echo 'Would you like to install gFortran (required if not already installed)? (y/n)'
read install
if  [ "$install" == "y" ] || [ "$install" == "Y" ]; then
  echo 'Downloading gFortran ...'
  curl -o gfortran-42-5664.pkg http://r.research.att.com/gfortran-42-5664.pkg
  echo 'Installing gFortran ...'
  sudo installer -pkg 'gfortran-42-5664.pkg' -target '/'
elif [ "$install" == "n" ] || [ "$install" == "N" ]; then
  echo 'Skipping gFortran install.'
else
  echo 'Did not recognize input. Exiting'
  exit 0
fi
echo 'Downloading ez_setup ...'
curl -o ez_setup.py http://peak.telecommunity.com/dist/ez_setup.py
echo 'Installing ez_setup ...'
sudo python ez_setup.py
echo 'Installing numpy ...'
sudo "${PYTHON}" -m easy_install -Z ${SERVER}/numpy-2.0.0.dev_f72c605_20110113-py2.6-macosx-10.6-universal.egg
echo 'Installing matplotlib ...'
sudo "${PYTHON}" -m easy_install -Z ${SERVER}/matplotlib-1.0.0-py2.6-macosx-10.6-universal.egg
echo 'Installing scipy ...'
sudo "${PYTHON}" -m easy_install -Z ${SERVER}/scipy-0.10.0.dev_20110113-py2.6-macosx-10.6-universal.egg
echo 'Installing pymc ...'
sudo "${PYTHON}" -m easy_install -Z ${SERVER}/pymc-2.2alpha-py2.6-macosx-10.6-universal.egg
echo 'Installing readline ...'
sudo "${PYTHON}" -m easy_install -Z readline
echo 'Installing ipython ...'
sudo "${PYTHON}" -m easy_install -Z ${SERVER}/ipython-0.11.dev-py2.6.egg
echo 'Installing nose ...'
sudo "${PYTHON}" -m easy_install -Z nose==0.11
echo 'Installing DateUtils'
sudo "${PYTHON}" -m easy_install -Z DateUtils
echo 'Done'

There is also a matplotlib pack available from UCSF here

Chris Fonnesbeck has returned (the chap I obtained the above scripts from)! To get the most recent stuff visit his site: StrongInference.

Advertisements

8 comments

  1. Hi,
    Tbanks for the info and for the link to the matplotlib egg file. That was useful to me. Then, I was trying to get the egg for numpy2.0 (numpy-2.0.0.dev-py2.6-macosx-10.6-universal.egg ) but it seems that the link is broken. Would you happen to have a copy ? If you do, I would appreciate if you could send one to me at *** at gmail_dot_com.
    Thanks you,
    Arthur

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s