A couple of weeks ago I got a new powerbook and installed leopard on
it, and decided to keep fairly detailed notes of the process of
getting developer svn versions of some of the scientific python tools
installed (matplotlib, ipython, numpy, scipy aka MINS).  The notes
will probably apply equally well for the released versions, but or
those of you embarking on getting a new OS X environment, up and
running, this might be helpful.  I tried to leave nothing to the
imagination so that this would be useful to newbies, so some of this
will be a bit tedious to unix or max veterans

== get access to the terminal ==

Put the "Terminal" on your dock launch bar.  It is in the
Applications->Utilities folder

== install gcc and other developer tools ==

Install XCode developer tools from the Leopard install CD under
optional packages.  Verify the install -- check for a working gcc

  > gcc --version
  i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)

== get the mac python python release ==

The consensus is that the python that ships with Apple is broken and
should be replaced with the universal binary from the mac python
community.  Go to the mac python site for downloads and install the
python 2.5 universal binary from there

  http://www.pythonmac.org/packages/py25-fat/index.html

Verify the python install

>  /usr/local/bin/python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Make sure that /usr/local/bin is in your PATH before the Apple
defaults.  I added this to the front of my default .bash_profile

PATH="/usr/local/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH

Start a new terminal instance and verify

  > which python
  /usr/local/bin/python

Get whatever else you want from pythonmac.org

== get svn checkouts of MINS ==

I am going to be installing most things from svn since I need
developerversions of many packages, but you may just want to get the
latest stable releases from this pythonmac site.  In particular, I
always run svn ipython, numpy, scipy and matplotlibx

= ipython =

    > svn co http://ipython.scipy.org/svn/ipython/ipython/trunk ipython
    > cd ipython
    > sudo python setup.py install

= numpy =

    > svn co http://svn.scipy.org/svn/numpy/trunk numpy
    > cd numpy
    > sudo python setup.py install

= scipy =

    > svn co http://svn.scipy.org/svn/scipy/trunk scipy

    http://scipy.org/Installing_SciPy/Mac_OS_X gives step-by-step
    instructions to install the vecLib Framework (should have been
    done in step one of the developer tools above) g77 compiler, the
    fftw libs, and the scipy build commands, do I won't repeat them
    here.  The only gotcha was I got an internal compiler error
    "qelg.f:1: internal compiler error: vector VEC ..." when I
    downloaded the intel gfortran binary linked from the site, so I
    grabbed the gfortran-intel-leopard-bin.tar.gz from
    http://hpc.sourceforge.net/ and reinstalled using

   > sudo tar -xvzf gfortran-intel-leopard-bin.tar.gz -C /

   and then did a clean build of scipy


= matplotlib =

matplotlib wants a GUI, so I am going to try wxpython2.8, which is
available from the pythonmac ite.  Because I am interested in
installing the enthought tools which need wxython (eg traits UI) I'm
going to see if I can get a wx enabled build of mpl going.  I
installed wxPython2.8-osx-unicode-2.8.3.0-universal10.4-py2.5.dmg from
the pythonmac site and am crossing my fingers that I don't find myself
entangled in wx version hell.

  > svn co  
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib

matplotlib depends on libpng and freetype, both of which are provided
by the xcode package in /usr/X11R6, so I am going to point the mpl
build to that directory.  sys.platform is "darwin", so edit
setupext.py and add '/usr/X11R6' to the "basedir" dictionary for the
'darwin' key.  You need to install pkgcong-0.22 from
http://pkgconfig.freedesktop.org/releases/ (just configure, sudo make
install it) so that matplotlib can use it to find an properly
configure png and freetype.  You will need to set the pkgcong path

  > export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

After all that, I could build mpl from svn with

  > python setup.py build
  > sudo python setup.py install

and successfully make a figure with

  > ipython -pylab
  >>> plot([1,2,3])

which used the wxagg backend.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to