Matplotlib is a dependency for PyCogent that isn't a trivial install on OSX. What follows is a minimal install instruction set that is simplified from this one.
Note: you have to have numpy installed first. This is straightforward, just type $ sudo easy_install -U numpy. Then the following will work.
I downloaded the tarball from here and decompressed. I opened the make.osx file. The listed stated dependencies and version numbers were:
ZLIBVERSION=1.2.3
PNGVERSION=1.2.33
FREETYPEVERSION=2.3.7
I wrote the following shell script to download these.

After downloading this script, you can run it by cd'ing into your download folder and executing it.
$ cd path/to/my/downloads
$ sh get_dependencies
I then decompressed each as follows:
$ tar -jxf libpng-1.2.33.tar.bz2
$ tar -jxf freetype-2.3.7.tar.bz2
$ tar -zxf zlib-1.2.3.tar.gz
Note: The order in which I did the following matters as the environment arguments used for two of them prevent libpng from building.
I did libpng first. I didn't set any environment variables. I simply cd'ed into the libpng-1.2.33/ and ran:
$ ./configure
$ make
$ sudo make install
I the set the following environment variables:
$ export MACOSX_DEPLOYMENT_TARGET=10.6
$ export CFLAGS="-arch i386 -arch x86_64"
$ export FFLAGS="-arch i386 -arch x86_64"
I cd'ed into the zlib directory, and did the configure/make/sudo make install as above.
I then did the same for the freetype directory.
I then edited the matplotlib/make.osx file as follows
PREFIX=/usr/local
PYVERSION=2.6
PYTHON=python${PYVERSION}
ZLIBVERSION=1.2.3
PNGVERSION=1.2.33
FREETYPEVERSION=2.3.5
MACOSX_DEPLOYMENT_TARGET=10.6
## You shouldn't need to configure past this point
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFLAGS="-Os -arch x86_64 -arch i386 -I${PREFIX}/include -I${PREFIX}/include/freetype2"
LDFLAGS="-arch x86_64 -arch i386 -L${PREFIX}/lib"
CFLAGS_DEPS="-arch i386 -arch x86_64 -I${PREFIX}/include -I${PREFIX}/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk"
LDFLAGS_DEPS="-arch i386 -arch x86_64 -L${PREFIX}/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk"
To save you editing, here's my edited copy of this file for download (just replace the one provided with matplotlib)

I then did the build and install as
$ make -f make.osx mpl_build
$ sudo python setup.py install
Then you need to make a directory to store matplotlib prefs as:
$ mkdir ~/.matplotlib
and copy the matplotlibrc.template file as
$ cp matplotlibrc.template ~/.matplotlib/matplotlibrc
Edit this matplotlibrc file so
backend : MacOSX
and you should be good to go.
Comments