os x leopard build step-by-step

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

  Mac OS X Python Packages for Universal Python 2.4 on Mac OS X 10.3.9 and later (Intel and PPC)

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 matplotlib download | SourceForge.net

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
Index of /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.

Thanks for posting these instructions. Forgive me if this has already been hashed out in previous emails, but do the instructions for iPython resolve the readline issues in Leopard?

Thanks,

Jeremy

···

On Nov 25, 2007 11:12 PM, John Hunter <jdh2358@…287…> wrote:

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

](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](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](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/](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

Hey John,

the info is now a wiki page for the workshop here:

http://ipython.scipy.org/moin/Py4Science/InstallationOSX

Anyone who has improvements, feel free to make them there. If you
don't have a wiki account, you'll see a message telling you that new
account creation is disabled, but it's actually not :slight_smile: I'll really
disable it again if the spammers come back, but for now I've
re-enabled wiki user creation but left the 'beware of the dog' message
in place to scare some of the stupider riff-raff.

Thanks for posting these instructions. Forgive me if this has already been
hashed out in previous emails, but do the instructions for iPython resolve
the readline issues in Leopard?

Well, some. We're just about ready to release ipython 0.8.2 and it
does work better with leopard. But auto-indentation and history
recall of multiline input appear broken. I don't yet have a leopard
box to test (but will in a few days) so for now we'll release as is.
Hopefully we'll finish up the full leopard support very soon though,
I'll make sure to post that info here when it's ready.

Cheers,

f

···

On Nov 25, 2007 9:24 PM, Jeremy Conlin <jeremit0@...287...> wrote:

I thought this was a problem that affected the apple python -- in the
instructions I posted I advise to use the macpython python. In any
case, since the instructions are for a svn install of ipython, the
leopard readline patches will be incorporated. All the readline
features I tested in my install worked as expected.

JDH

···

On Nov 25, 2007 10:24 PM, Jeremy Conlin <jeremit0@...287...> wrote:

Thanks for posting these instructions. Forgive me if this has already been
hashed out in previous emails, but do the instructions for iPython resolve
the readline issues in Leopard?