Installing scientific computing packages for Python in Mac OS X

There are several options for installation Python and related packages in Mac OS X, two of which are described here. (A third option, not described here, is to piggyback off the built-in version of Python that exists in /usr/bin/python.)

Option 1. Enthought Python bundle

Enthought, Inc. has made available the Python Enthought Distribution, which bundles the Python interpreter (version 2.5) along with many useful packages for scientific computing (and, fortunately, most of what we need for the computational methods course). Although you will not need everything provided in the Enthought bundle, the one-stop shopping (almost) is useful and quick. Download the package from the download page, follow the installation instructions, and complain (politely, of course) to Enthought if something goes awry.

Option 2: Fink

Installing useful third-party software under Mac OS X is greatly simplified by Fink, a port of the Debian Linux apt and dpkg systems for package management. This option is useful if (a) you already have Fink running on your Mac OS X system, or (b) you will want to install other, non-Python-related packages that are also available through Fink.

Download Fink (from finkproject.org) and install it. Optionally there is a separate program, called FinkCommander, that provides a graphical interface to Fink, but it is easy enough to use Fink from the command line. Fink manages dependencies, and will prompt you to install other packages if necessary. It installs everything it needs in the directory /sw.

Fink packages

Some of the packages listed below are classified by fink as "unstable". This does not make them unusable, but reflects rather that they have been tested less than the stable packages. Configure fink to "use unstable packages" so that these can be located. This can also be done - after fink has been installed - by editing the file /sw/etc/fink.conf and adding to the list of allowed Trees the "unstable/main" tree, so that your Trees line looks something like this: Trees: local/main stable/main stable/crypto unstable/main

python25

The core python package: even though OS X comes with python preinstalled, you'll want to install a python package in fink; python25 is the most recent. Subsequent to this, fink will install all other python-related packages in /sw/lib/python25/site-packages.

scipy-py25

SciPy, which contains many useful algorithms for integrating ODEs, optimizing functions, etc. Note that the scipy.org web site contains information on building SciPy under Mac OS X. The build via fink proposed here seems generally more reliable and manages all the various dependencies that one would otherwise need to worry about.

visual-py25

VPython or Visual Python, a 3D graphics environment

matplotlib-py25

Matplotlib, a MATLAB-inspired plotting package

pil-py25

Python Imaging Library (PIL), useful for creating and manipulating images.

ImageMagick

ImageMagick (fink package: imagemagick) provides utilities for manipulating images. Currently we are using the "display" utility to draw image files on the screen. The ImageMagick display utility (and probably many other pieces of ImageMagick) requires XWindows (e.g., Apple's X11, or Xfree86 under fink). Installing Apple's X11 opens a world of functionality, but if you're reluctant to do so, there is a workaround for displaying images. Apple's Preview application will display image files; instead of calling "display filename" to use ImageMagick's display, call "open /Applications/Preview.app filename" (even if this is being done in a system call within python).