- 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.
SciPy is dependent on a number of third-party libraries and programs, each of which is available for the Mac OSX platform. Some of these components are available via Fink, however I do not recommend this in general because of the way Fink looks for dependencies; it can result in several redundant components being installed on your system. All of the necessary components for building and installing SciPy can be obtained elsewhere, and installed with little trouble.
Python
If you are running Panther (OSX 10.3) or Tiger (10.4), MacPython v.2.3 is already installed on your machine. However, we strongly recommend installing a separate Python interpreter. Either the official Python distribution or ActiveState Python distribution are good. Note that these are Universal binaries and will only work with 10.3.9 and above. Compiling extension modules for these distributions may not work on 10.3.9 because Apple has not made compilers available that make Universal binaries on 10.3.9.
If you are missing readline support for your installation of Python, I recommend following these instructionsfor 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).
For Universal builds of Python (i.e. all of the major ones), you will need to use gcc version 4.0 and the corresponding FORTRAN compiler. On PPC OS X 10.4 installations, you may need to make sure that you are using this version with the following command:
sudo gcc_select 4.0
Intel OS X 10.4 installations should already have this taken care of.
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.
FFTW Libraries
FFTW is a C subroutine library for performing fast Fourier transformations. Download version 3.1.2 and run the following from the download directory:
tar -xvzf fftw-3.1.2.tar.gz (or tar -xvf if it has already been gunzipped) cd fftw-3.1.2 ./configure make sudo make install
Several OSX users have reported that this version is not detected by SciPy during the build process. If this is the case, you will need to add the following symbolic links (assuming that you installed FFTW in the default location):
ln -s /usr/local/lib/libfftw3.a /usr/local/lib/libfftw.a ln -s /usr/local/lib/libfftw3.la /usr/local/lib/libfftw.la ln -s /usr/local/include/fftw3.h /usr/local/include/fftw.h
Obtaining and Building NumPy and SciPy
You may install NumPy and SciPy either by checking out the source files from the SVN repository 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) and build/install as follows:
python setup.py build sudo python setup.py install
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
Check out the following branches of the repository:
svn co http://svn.scipy.org/svn/numpy/trunk numpy svn co http://svn.scipy.org/svn/scipy/trunk scipy
First, install Numpy:
cd numpy python setup.py build sudo python setup.py install
Then, the full SciPy package:
The default is to build for 10.3. If you want to build for 10.4 only then do this from the same shell that you are using to build scipy
export MACOSX_DEPLOYMENT_TARGET=10.4
cd ../scipy python setup.py build_src build_clib --fcompiler=gnu95 build_ext --fcompiler=gnu95 build sudo python setup.py install
For PPC users who are using g77 3.4 to build scipy, use this build command instead:
python setup.py build_src build_clib --fcompiler=gnu build_ext --fcompiler=gnu build
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)
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:
- Your OS version
- The versions of gcc and gfortran and where you obtained gfortran
$ gcc --version
$ gfortran --version
- The versions of numpy and scipy that you are trying to install
The full output of $ python setup.py build
Installing SciPy/Mac OS X (last edited 2007-11-04 13:23:43 by jdh2358)
No comments:
Post a Comment