Hi,

First of all, thanks to the matplotlib developers for all the great job.  I
have just successfully installed matplotlib from source (r8827) in my
macbook for python 2.7. However, I found a couple of bumps in the road that
I'd like to share:

1) Dependencies: I initially used make.osx to fetch and build png, freetype
and zlib. However, for libpng for some reason either urllib was not fetching
the right file or it was corrupted,  and when running:
 sudo make -f make.osx fetch deps
make crashed because of an error in tar when trying to unpack the source (I
tried tar myself and it also crashed). I ended up downloading manually the
sources and then used make.osx to install each of them individually. Also,
at least in the case of libpng, the exact version does not seem to matter,
and I ended up upgrading to libpng 1.4.5.

2) make.osx configuration: in my case I had to change the python version and
mac osx targets to 2.7 and 10.5 respectively, and I selected /usr/local as
the prefix. Still, I found a problem with the architecture flags that made
the linker fail when running:
sudo make -f make.osx mpl_build
After struggling a little bit it turned out that the problem was in setup.py
itself, which called c++ using the -arch ppc flag. This is probably due to
the fact that the OSX package provided by Python.org for Mac OS X below 10.6
(Leopard and below) is a universal binary and therefore python compiles
against i386 and ppc  architectures. Now, make.osx lets you change the
architecture flags in line 11, however the compiler and linker flags do not
use the variable defined there, and -arch ppc must be added in both lines 20
and 21.

3) After building matplotlib, contrary to what is mentioned in a couple of
sites, python setup.py install crashed and I had to use make.osx to install
matplotlib. One important thing when make.osx is used is that it installs
matplotlib in a site-package directory that hangs from the PREFIX directory
that has to be defined in make.osx, instead of sniffing the site-package
used by the current version of python. Therefore, I had to copy everything
into the site-package folder inside of .../Python.framework/Versions/2.7 in
order to be able to import it. Alternatively, you can add the alternative
site-package path to PYTHONPATH, but it is less tidy, in my opinion.

All in all, a bumpy experience and not too user-friendly, but at least it
worked. I include below a copy of the final make.osx that worked for me:

Cheers,

AY

# build mpl into a local install dir with
PREFIX=/usr/local
MPLVERSION=1.0rc1
PYVERSION=2.7
PYTHON=python${PYVERSION}
ZLIBVERSION=1.2.3
PNGVERSION=1.4.5
FREETYPEVERSION=2.3.11
MACOSX_DEPLOYMENT_TARGET=10.5
OSX_SDK_VER=10.5
#Next line is useless, see below:
ARCH_FLAGS="-arch i386 -arch ppc"

## You shouldn't need to configure past this point -- Actually I did

# Commenting 20 and 21 and uncommenting the CFLAGS and LDFLAGS below should
also work

#PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
#CFLAGS="${ARCH_FLAGS} -I${PREFIX}/include -I${PREFIX}/include/freetype2
-isysroot /Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
#LDFLAGS="${ARCH_FLAGS} -L${PREFIX}/lib
-syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"

PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFLAGS="-arch i386 -arch ppc -I${PREFIX}/include
-I${PREFIX}/include/freetype2 -isysroot
/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
LDFLAGS="-arch i386 -arch ppc -L${PREFIX}/lib
-syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to