Building matplotlib for Snow Leopard

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.

Download file "get_dependencies"

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)

Download file "make.osx"

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

/groups/huttleylab/search/index.rss?tag=hotlist/groups/huttleylab/search/?tag=hotWhat’s HotHotListHot!?tag=hot12/groups/huttleylab/sidebar/HotListgavinGavin Huttley2010-04-01 06:21:30+00:002010-04-01 06:21:30updated16gavinGavin Huttley2008-08-19 03:51:22+00:002008-08-19 03:51:22updated15gavinGavin Huttley2008-08-04 06:30:09+00:002008-08-04 06:30:09updated14gavinGavin Huttley2008-08-04 00:29:39+00:002008-08-04 00:29:39updated13gavinGavin Huttley2008-08-04 00:28:56+00:002008-08-04 00:28:56updated12gavinGavin Huttley2008-08-04 00:28:14+00:002008-08-04 00:28:14updated11gavinGavin Huttley2008-07-31 04:29:36+00:002008-07-31 04:29:36updated10gavinGavin Huttley2008-07-31 04:27:30+00:002008-07-31 04:27:30updated9gavinGavin Huttley2008-07-31 04:26:37+00:002008-07-31 04:26:37updated8Added tag - mirrorgavinGavin Huttley2008-07-31 04:19:56+00:002008-07-31 04:19:56addTag7Added tag - synchronisegavinGavin Huttley2008-07-31 04:19:47+00:002008-07-31 04:19:47addTag6Added tag - backupgavinGavin Huttley2008-07-31 04:19:42+00:002008-07-31 04:19:42addTag5Added tag - commandgavinGavin Huttley2008-07-31 04:19:40+00:002008-07-31 04:19:40addTag4Added tag - unixgavinGavin Huttley2008-07-31 04:19:38+00:002008-07-31 04:19:38addTag3Added tag - hotgavinGavin Huttley2008-07-31 04:19:36+00:002008-07-31 04:19:36addTag2First additiongavinGavin Huttley2008-07-31 04:19:32+00:002008-07-31 04:19:32created1wiki2010-04-01T06:21:30+00:00groups/huttleylab/wiki/913dbFalseSynchronise with Unison/groups/huttleylab/wiki/913db/Synchronise_with_Unison.htmlGavin Huttley16 updatesSynchronise with Unison Why use unison? Unison is a cross platform tool that uses the very efficient rysnc algorithm for synchronisation. I have compiled thi...Falsegavin2010-04-01T06:21:30+00:00gavinGavin Huttley2009-12-07 02:59:50+00:002009-12-07 02:59:50updated17gavinGavin Huttley2009-12-07 02:56:42+00:002009-12-07 02:56:42updated16gavinGavin Huttley2009-12-07 02:54:33+00:002009-12-07 02:54:33updated15gavinGavin Huttley2009-12-07 02:52:55+00:002009-12-07 02:52:55updated14gavinGavin Huttley2009-12-07 02:30:52+00:002009-12-07 02:30:52updated13gavinGavin Huttley2009-12-07 02:30:13+00:002009-12-07 02:30:13updated12gavinGavin Huttley2009-12-07 02:29:36+00:002009-12-07 02:29:36updated11gavinGavin Huttley2009-12-07 02:29:06+00:002009-12-07 02:29:06updated10gavinGavin Huttley2009-12-07 02:28:50+00:002009-12-07 02:28:50updated9gavinGavin Huttley2009-12-07 02:28:20+00:002009-12-07 02:28:20updated8gavinGavin Huttley2009-12-07 02:28:03+00:002009-12-07 02:28:03updated7Added tag - buildgavinGavin Huttley2009-12-07 01:23:53+00:002009-12-07 01:23:53addTag6Added tag - installgavinGavin Huttley2009-12-07 01:23:50+00:002009-12-07 01:23:50addTag5Added tag - matplotlibgavinGavin Huttley2009-12-07 01:23:48+00:002009-12-07 01:23:48addTag4gavinGavin Huttley2009-12-07 01:23:42+00:002009-12-07 01:23:42updated3Added tag - hotgavinGavin Huttley2009-12-07 01:03:01+00:002009-12-07 01:03:01addTag2First additiongavinGavin Huttley2009-12-07 01:02:57+00:002009-12-07 01:02:57created1wiki2009-12-07T02:59:50+00:00groups/huttleylab/wiki/da9feFalseBuilding matplotlib for Snow Leopard/groups/huttleylab/wiki/da9fe/Building_matplotlib_for_Snow_Leopard.htmlGavin Huttley17 updatesBuilding matplotlib for Snow Leopard Matplotlib is a dependency for PyCogent that isn't a trivial install on OSX. What follows is a minimal install instruction set that is simplifi...Falsegavin2009-12-07T02:59:50+00:00gavinGavin Huttley2009-10-05 11:29:27+00:002009-10-05 11:29:27updated12gavinGavin Huttley2009-05-28 16:12:46+00:002009-05-28 16:12:46updated11gavinGavin Huttley2009-05-28 16:12:22+00:002009-05-28 16:12:22updated10gavinGavin Huttley2009-05-28 16:11:44+00:002009-05-28 16:11:44updated9gavinGavin Huttley2009-05-28 16:10:51+00:002009-05-28 16:10:51updated8gavinGavin Huttley2009-05-27 19:04:57+00:002009-05-27 19:04:57updated7gavinGavin Huttley2009-05-27 19:03:33+00:002009-05-27 19:03:33updated6Added tag - developmentgavinGavin Huttley2009-05-27 19:03:30+00:002009-05-27 19:03:30addTag5Added tag - virtualenvgavinGavin Huttley2009-05-27 19:02:58+00:002009-05-27 19:02:58addTag4Added tag - pythongavinGavin Huttley2009-05-27 19:02:47+00:002009-05-27 19:02:47addTag3Added tag - hotgavinGavin Huttley2009-05-27 19:02:42+00:002009-05-27 19:02:42addTag2First additiongavinGavin Huttley2009-05-27 18:54:00+00:002009-05-27 18:54:00created1wiki2009-10-05T11:29:27+00:00groups/huttleylab/wiki/25996FalsePython development in a sandbox/groups/huttleylab/wiki/25996/Python_development_in_a_sandbox.htmlGavin Huttley12 updatesPython development in a sandbox A couple of people have been bitten in the last week by having multiple working copies of PyCogent and/or custom code that they were aiming to ...Falsegavin2009-10-05T11:29:27+00:00gavinGavin Huttley2009-09-14 04:39:39+00:002009-09-14 04:39:39updated10gavinGavin Huttley2009-09-14 04:34:16+00:002009-09-14 04:34:16updated9gavinGavin Huttley2009-09-14 04:32:39+00:002009-09-14 04:32:39updated8gavinGavin Huttley2009-09-14 04:16:44+00:002009-09-14 04:16:44updated7gavinGavin Huttley2009-09-14 04:11:27+00:002009-09-14 04:11:27updated6gavinGavin Huttley2009-09-14 04:10:45+00:002009-09-14 04:10:45updated5gavinGavin Huttley2009-09-14 04:09:01+00:002009-09-14 04:09:01updated4Added tag - developmentgavinGavin Huttley2009-09-14 04:08:15+00:002009-09-14 04:08:15addTag3Added tag - hotgavinGavin Huttley2009-09-14 04:08:10+00:002009-09-14 04:08:10addTag2First additiongavinGavin Huttley2009-09-14 04:07:00+00:002009-09-14 04:07:00created1wiki2009-09-14T04:39:39+00:00groups/huttleylab/wiki/62040FalseCode review guidelines/groups/huttleylab/wiki/62040/Code_review_guidelines.htmlGavin Huttley10 updatesCode review guidelines What follows is a modified version of a document written by Rob Knight that we're adopting locally. The most difficult part of writing cod...Falsegavin2009-09-14T04:39:39+00:00gavinGavin Huttley2009-07-01 07:28:01+00:002009-07-01 07:28:01updated7Added tag - tipgavinGavin Huttley2009-06-06 20:39:55+00:002009-06-06 20:39:55addTag6Added tag - researchgavinGavin Huttley2009-06-06 20:39:53+00:002009-06-06 20:39:53addTag5Added tag - hotgavinGavin Huttley2009-06-06 20:39:47+00:002009-06-06 20:39:47addTag4gavinGavin Huttley2009-06-06 20:39:38+00:002009-06-06 20:39:38updated3gavinGavin Huttley2009-06-06 20:35:00+00:002009-06-06 20:35:00updated2First additiongavinGavin Huttley2009-06-06 20:32:09+00:002009-06-06 20:32:09created1wiki2009-07-01T07:28:01+00:00groups/huttleylab/wiki/0c86aFalseManagement of computational analyses involving multiple machines/groups/huttleylab/wiki/0c86a/Management_of_computational_analyses_involving_multiple_machines.htmlGavin Huttley7 updatesManagement of computational analyses involving multiple machines The basic lab research model analyses and software "development" work is done on laptops modestly time consuming analy...Falsegavin2009-07-01T07:28:01+00:00hot/groups/huttleylab/search/index.rss?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcomelist/groups/huttleylab/search/?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcomeRecent ChangesRecentChangesListUpdates?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcome0/groups/huttleylab/sidebar/RecentChangesListmodifiedDateallRecent ChangesRecentChangesListUpdateswiki/welcomeNo recent changes.reverse5searchlist/groups/huttleylab/calendar/Upcoming EventsUpcomingEventsListEvents1Getting events…