How to Install Python as a Replacement to Matlab

Larsson Omberg

Python has matured to the point where it is a very powerful computational environment with flexibility that is unmatched by any commercial product. But this flexibility comes at the cost of a very fragmented install procedure. The default installation of python is feature poor and the needed features for computations are spread out over many different packages. For windows there is the Enthought edition which combines many useful packages into one install. As of this writing the Unix/Linux installation is less user friendly and requires many dependencies.

The approach taken here is supported by the idea that the most complete, stable, fastest and up to date installation comes from compiling the latest sources. To simplify the process I supply a shell script that does all of the necessary commands for you. Please be advised that this works for my system and might need to be modified for your special needs.

Relevant Packages:

  • ATLAS - Automatically Tuned Linear Algebra Software. (speeds up SciPy and Numeric)
  • Numeric - Also known as numpy or numerical Python (required by SciPy)
  • F2PY - Fortran to Python interface generator (required by SciPy)
  • SciPy - Library of scientific tools
  • Vpython - 3D Programming for Ordinary Mortals
  • Matplotlib - 2D plotting library with similar syntax to Matlab
  • IPython - An enhanced Interactive Python shell
  • Other interesting links and packages not installed
    • Install Script - Shell script that downloads and installs above files
    • VTK - 3D Visualization Toolkit
    • MayaVi - Data Visualization Tool
    • BioPython - Computational tools for Molecular Biology

Install ATLAS

Follow instructions at www.scipy.org or run script

Numerical Python (Numpy)

  1. Get latest tar ball of numpy (Numeric-23.7.tar.gz)
  2. Untar the tarball: tar xfvz Numeric-23.7.tgz
  3. Do the usual: python setup.py install

F2PY

  1. Download the latest tar ball F2PY-2-latest.tar.gz
  2. Untar file: tar xfvz F2PY-2-latest.tar.gz
  3. Do the usual: python setup.py install

SciPy

Follow instructions from http://www.scipy.org/documentation/buildscipy.txt summarized below.
  1. Download latest tar ball (SciPy_complete-0.3.2.tar.gz)
  2. Define location of atlas: export ATLAS=/usr/lib/atlas
  3. Untar file: tar xfvz SciPy_complete-0.3.2.tar.gz
  4. Do usual: python setup.py build
  5. Followed by: python setup.py install

Vpython

  1. Make sure gtkglarea is installed
  2. Download latest tarball visual-3.1.0.tar.bz2
  3. Untar file: tar xfvj visual-*
  4. Run command: ./configure --prefix=/usr
  5. Followed by: make
  6. Followed by: make install

Matplotlib

  1. Download latest tarball: (matplotlib-0.71.tar.gz)
  2. Untar file: tar xfvz matplotlib*
  3. Do usual: python setup.py build
  4. Do usual: python setup.py install

IPython

  1. Download latest file: (ipython-0.6.10.tar.gz)
  2. Untar file: tar xfvz ipython*
  3. Do usual: python setup.py install