Underworld

a long term geodynamics simulation platform

Python Download and Installation


Why do I need Python and how do I know if I already have it installed?

Python is required to compile PETSc and Mercurial, is used by the SCons build system in use by Underworld, the CREDO system testing and analysis framework, and several other optional components in Underworld. A minimum of Python 2.5 is required for CREDO and Mercurial. Python should already come installed on most systems. To check have it, open a terminal and type:

which python

which should display the file location of the executable (e.g. /usr/bin/python).

Note for unix / linux users of Mercurial: refer to the Mercurial homepage (link provided at MercurialDownload) for guidelines on the version of Python required for your operating system. A minimum of Python 2.5 is required.

Note for unix / linux users of SCons (but not Mercurial): if you are using a version of Python earlier than Python 1.6, refer to the "Installation Requirements" section of the README.txt file that downloads with SCons, regarding distutils.

Note for mac users of Mercurial: Mercurial on the mac requires at least Python 2.5 - 2.x. For MacOS 10.5, a native version of Python 2.5.* should have come preinstalled on your mac. However for MacOS 10.3.9 to 10.4, you will need to install Universal Python for OS X 2.5 - see http://www.python.org/ for further details.

If you already have Python installed, go to Setting up Environment Variables section below.


Downloading and Installing Python on Linux / Unix

These instructions apply to any Linux, Unix operating system (and mac, however there is a disk image installation available for the mac, see details in next section).

The Python source can be downloaded from its website. (look for a file like Python-2.5.2.tgz).

Untar and unzip the downloaded file::

tar zxvf Python-2.5.2.tgz

Then navigate into the unzipped directory and type the following, where /usr/local/python is the location in which you would like to install python (root or administrator access may be required):

./configure --prefix=/usr/local/python
make
make install


Downloading and Installing Python on macs

Note for mac users of Mercurial: Mercurial on the mac requires at least Python 2.5. For MacOS 10.5, a native version of Python 2.5.* should have come preinstalled on your mac. However for MacOS 10.3.9 to 10.4, you will need to install Universal Python for OS X 2.5 - see http://www.python.org/ for further details.

From a disk image

Go to http://www.python.org/ and download the python disk image appropriate for your version of MacOSX, to your desktop. Then simply double-click on the disk image and follow the instructions provided. By default the path to your new python installtion may be added to your ~/.bash_profile. If you do not use a .bash_profile file, you will need to add the path manually (see next section).

Using MacPorts

Note: If you intend to use Macports packages to install the dependencies required by Underworld and gLucifer, we recommend you use Macports for all dependencies (except PETSc). This will avoid problems of confusion between Macports-installed and default system libraries such as X11, which can cause run-time issues.

Type the following (from any directory, assuming you have MacPorts in your path):

port install python26


Setting up Environment Variables Manually

Add the following environment variable to your ~/.bashrc (if you are using bash) or ~/.tcshrc (if you are using tcsh), where /usr/local is the directory in which python is located:

bash:

on linux / unix:

export PYTHON_DIR=/usr/local/python

on macs:

export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}

tcsh:

on linux / unix:

setenv PYTHON_DIR /usr/local/python

on macs:

setenv PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}


-- Wendy Mason - 28 October 2010
-- Patrick Sunter - 21 October 2010
-- Wendy Sharples - 21 October 2010
-- John Spencer - 16 Jul 2008
-- Alan Lo - 25 Jan 2006