Table of contents


These instructions describe how to install NumPy and SciPy from source. If you would rather install pre-built binaries, go to the Download page and install the packages linked from there.

Python

Apple ships its own version of Python with OS X. However, we strongly recommend installing the official Python distribution.

If you are missing readline support for your installation of Python, I recommend following these instructions for getting it installed with relative ease.

Apple's Developer Tools

Apple's Developer Tools provide a number of key libraries, particularly the vecLib Framework , which includes BLAS and LAPACK. Install the most recent version from Apple's Developer Connection site (after free registration). The most recent version may also be included on your OS X installation CD. Ensure that all components are installed by choosing customize when available during the install process and selecting all optional packages (at least the X11 development tools and the 10.4 SDK).

On OS X 10.6 the default gcc version is 4.2, while NumPy and SciPy need to be built with 4.0. For gcc the correct version should be picked up automatically, for C++ code (only in SciPy) you should ensure that g++ and c++ default to 4.0. One way to achieve this is to create symlinks

    ln -s /usr/bin/g++-4.0 g++
    ln -s /usr/bin/g++-4.0 c++

and add these to the front of your PATH.

FORTRAN

Though virtually any commercial C/C++ compiler may be used with SciPy, OS X come with GNU C compilers preinstalled. The only thing missing is the GNU FORTRAN compiler.

Binaries of gfortran (GNU F95, this is a version of the much awaited, free, open source, F95 compiler) are available from this site (download universal binary)

We previously recommended the binaries at Guarav Khanna's High Performance Computing for Mac OSX] site but these are not universal binaries and do not play well with the pythonmac universal binaries.

Obtaining and Building NumPy and SciPy

You may install NumPy and SciPy either by checking out the source files from the SVN repository (or with git from the git mirror) or unpacking them from a source archive file from the Download page. If you choose the latter, simply expand the archive (generally a gzipped tar file), otherwise check out the following branches from the repository:

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

Both NumPy and SciPy are built as follows:

    python setup.py build
    sudo python setup.py install

or, using scons,

    python setupscons.py scons --jobs=2

The above applies to the official Python distribution, which is 32-bit only as of now. For alternative 64-bit Pythons (either from Apple or home-built) on Snow Leopard, you may need to extend your build flags to specify the architecture

LDFLAGS="-arch x86_64" FFLAGS="-arch x86_64"

for example

LDFLAGS="-arch x86_64" FFLAGS="-arch x86_64" python setupscons.py scons

If you choose to build from SVN, make sure you have SVN installed. A package installer for SVN 1.4.4-2 can be found at Download Here

After a successful build, you may try running the built-in unit tests for SciPy:

    python
    >>> import numpy
    >>> numpy.test('1','10')
    >>> import scipy
    >>> scipy.test('1','10')

Be sure not to import numpy or scipy while you're in the numpy/scipy source tree. Change directory first.

If you have any problems installing SciPy on your Mac based on these instructions, please check the scipy-users and scipy-dev mailing list archives for possible solutions. If you are still stuck, feel free to join scipy-users for further assistance. Please have the following information ready:


CategoryInstallation

Installing SciPy/Mac OS X (last edited 2010-05-08 10:07:40 by RalfGommers)