Installing NumPy and SciPy on Mac OSX 10.8 (Mountain Lion)

I am playing with ExpEyes, which is awesome tool for anyone who wants to learn electronics (and physics).

ExpEyes comes with software (written in python) for GNU/Linux and Windows. I intend to run it on Mac OSX, because it can (provided all dependencies are met).

It is generally easy to install python packages on OSX using easy_install or pip, however, installing NumPy and SciPy turned out to be pain on OSX (10.8.2, latest version the time of posting).

In my case, I am using python binary installed via homebrew, so I can’t take advantage of numpy (which comes installed with mountain-lion).

I have XCode 6 installed, which comes with gcc-4.2.1 (llvm build). I figured out, I can build numpy and scipy from source.

Following is what I did to build numpy and scipy. SciPy requires gfortran, so that has to be installed (I used homebrew to do that):

$ git clone https://github.com/numpy/numpy.git
$ git clone https://github.com/scipy/scipy.git
$ cd numpy
$ python setup.py build && python setup.py install
$ brew install gfortran
$ cd ../scipy
$ python setup.py build && python setup.py install

BTW! In case, you are wondering, why didn’t I use Scipy Superpack script, which indeed makes job easier?

I didn’t, because I want to install gnu/unix packages using homebrew, and I already have git and other things. Super Spicypack downloads (gfortran, etc.), builds and installs packages directly to system, making it harder to remove those later? Homebrew makes job easier.

  • Kris Murti

    Does your scipy.test() and numpy.test() return error free? I went the macport route and am considering this route. Did you also get iPython ?

    • http://www.abdulqabiz.com/blog/ Abdul Qabiz

      I didn’t get iPython. I used brew to install dependencies, and then installed scipy and numpy in manner it has been described in post.

      scipy.test() and numpy.test() don’t return errors.

  • Zura Isakadze

    I installed them via macports on OSX 10.8.4:
    tests results in ipython
    scipy.test() —

    numpy.test() —

  • Travis Oliphant

    If you install Anaconda (which is completely free) you also get conda which is a cross-platform package management tool that makes it easy to install all of this software (for Python 3 as well). Conda is an open-source (BSD license) tool for doing package management.