« Building NumPy, SciPy & Matplotlib for Python 2.7 on Snow Leopard django-lastfm 1.0 »
.

Building SciPy on Snow Leopard with Python 2.7

I recently had some struggle to build and install SciPy 0.8.0 on Mac OS X 10.6 Snow Leopard, but actually it’s quite easy.

I used the instructions on scipy.org and the HJBlog as source. Since there are builds of NumPy 1.5.0 for Python 2.7 available, you don’t need to install fftw and umfpack manually.

You only need to install gfortran from this site. Pick the latest build for Snow Leopard (e.g. this one).

Next, install NumPy with the disk image from SourceForge or with pip:

$ pip install numpy

To build and install SciPy, download the latest version from SourceForge and do the following:

$ tar -xf scipy-0.8.0.tar.gz
$ cd scipy-0.8.0
$ export CFLAGS="-arch i386 -arch x86_64"
$ export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
$ export FFLAGS="-arch i386 -arch x86_64"
$ export MACOSX_DEPLOYMENT_TARGET=10.6
$ python setup.py build
$ python setup.py install

Everything in one command:

$ CFLAGS="-arch i386 -arch x86_64" LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64" FFLAGS="-arch i386 -arch x86_64" MACOSX_DEPLOYMENT_TARGET=10.6 python setup.py build install

I hope this works for you as well as it did for me.

Comment

  1. Todd Small on November 28, 2010 at 03:11:

    Thanks for the straightforward instructions. They worked perfectly for me.

    Todd

  2. Arif Abdullah on December 4, 2010 at 09:09:

    Very useful. Thanks for sharing :)

  3. Connor on January 14, 2011 at 20:32:

    Thanks! This finally got it working.

  4. Milo Lennot on May 6, 2011 at 15:41:

    Thank you very much for simple, concise and working approach :)

  5. Greg on January 23, 2012 at 20:33:

    After hours of failed attempts and mountains of psychic pain, this was the strategy that finally worked. Thanks for being a python hero!

  6. meowsqueak on July 5, 2012 at 14:00:

    This worked well for scipy 0.12.0.dev-a792eb7 on Mac OS X 10.6.8, with a locally built python-2.7.3, a 'pip installed' numpy-1.6.2, and gfortran-4.2.3. No unexpected errors in 'scipy.test()'.

    Thank you.

  7. Piet on October 5, 2012 at 05:27:

    Hi Stefan,

    I have tried running this file, but it doesn't work. The commands are all set in Terminal right? I have installed and re-installed different files (e.g. python 2.6 to python 2.7 back to python 2.7, but also for ipython, numpy, scipy, etc.) which i think is screwing me up as well.

    Any ideas on how i can start from a blank sheet and make this file work?

  8. Stefan on October 5, 2012 at 08:31:

    What exactly are the error messages you get? And did you install Xcode (and the Command Line Tools)?

  9. Piet on October 5, 2012 at 15:03:

    Hi Stefan,

    I got it wrong and actually was talking bout this blog post:

    http://stefan.sofa-rockers.org/2010/11/17/building-numpy-scipy-matplotlib-python-27-snow-leo/

    I rand the different files but finally got an error message that read:

    "http://somethingaboutorange.com/mrl/projects/nose"

    I was able to import numpy and scipy (as before), but matplotlib is giving me troubles...

  10. Piet on October 5, 2012 at 15:04:

    The error message above was incomplete - sorry - this is the full one.

    ImportError: Need nose >= 0.10.0 for tests - see http://somethingaboutorange.com/mrl/projects/nose

  11. Stefan on October 5, 2012 at 19:12:

    You need to install nose (e.g. via pip) to run Numpy’s and SciPy’s test suite.

New comment

Required
Required, but not displayed
Optional
Format using ReStructuredText (Quickref)
  • *emphasis*, **strong**, ``inline code``
  • Blockquotes: indent each line to be quoted
  • Links w/ description: `Description <URL>`_
  • Highlighted code blocks: See here
captcha Please prove that you are human.