Installing local versions of scipy's ndimage (or stsci) packages

These instructions are for people who are having problems installing scipy from the executable or building it from source.  These instructions have been tested on Linux.

Install scipy.ndimage

Opus needs both numpy and the scipy.ndimage package.  The scipy.ndimage package is included in numarray, but not in numpy.  If you need it, the recommended route is to install scipy.  

In some cases, it is not practical to install scipy.  For instance, installing scipy can be difficult if you need to build scipy from source on a Linux machine where you do not have root permissions.  

If you cannot install scipy, you can instead install just the scipy.ndimage.  We have stashed a copy of this package on our website and modified it to install into the scipy directory of your site-packages directory.  Here are the instructions for installing this package:

  1. Create a site-packages directory into which to install additional packages (e.g.: ~home/python25/lib/python2.5/site-packages).
  2. Add this site-packages directory to your PYTHONPATH.
  3. Create a scipy directory within site-packages (e.g. ~home/python25/lib/python2.5/site-packages/scipy).  This is needed so that the two scipy subpackages have a place in which to install.
  4. Create a __init__.py file in the scipy folder (e.g. ~/home/python25/lib/python2.5/site-packages/scipy/__init__.py).  Python needs this file to exist in order to be able to import scipy.  The file may be empty.
  5. Download ndimage.zip.  This version is compatible with the latest Opus and UrbanSim.
  6. Unzip ndimage.zip.
  7. cd into the unzipped directory.
  8. Make a temporary directory in which to install the code, say ~/temp_install_dir.
  9. Build and install the package via a command like the following.  (The path after the --prefix parameter is the location containing the Python lib directory in which to install the code.)
    python setup.py install --prefix=~/temp_install_dir
  10. Now move the directory ~/temp_install_dir/lib/python2.5/site-packages/ndimage into the scipy directory in site-packages. If your site-packages directory is at the example location above, you should end up with an ndimage directory in this location: ~home/python25/lib/python2.5/site-packages/scipy/ndimage

The reason for doing the last two steps rather than installing ndimage directly is that we want it to be a subpackage under scipy rather than its own package at the top level.

Install scipy.stsci (rarely needed)

In rare cases, you may also want the stsci package.  This package is not used by Opus or UrbanSim.  You should only need this if you have written code that used numarray.convolve or numarray.image, or want to write code that uses stsci.  As with ndimage, this package is included in numarray, but not in numpy.  

If you need to install scipy.stsci and cannot install the full scipy package, repeat steps 6-8, above, for stsci.zip.