Installation

Requirements

You need to have the following software properly installed in order to build TAO for Python:

[1]Unless you have appropiatelly configured and built TAO and PETSc without MPI (configure option --with-mpi=0).
[2]You may need to use a parallelized version of the Python interpreter with some MPI-1 implementations (e.g. MPICH1).

Using pip or easy_install

You can use pip to install tao4py and its dependencies (mpi4py is optional but highly recommended):

$ pip install [--user] numpy mpi4py
$ pip install [--user] petsc petsc4py
$ pip install [--user] tao tao4py

Alternatively, you can use easy_install (deprecated):

$ easy_install [--user] tao4py

If you already have working PETSc and TAO builds, set environment variables TAO_DIR and PETSC_DIR (and perhaps PETSC_ARCH for prefix installs) to appropriate values and next use pip:

$ export TAO_DIR=/path/to/tao
$ export PETSC_DIR=/path/to/petsc
$ export PETSC_ARCH=arch-linux2-c-opt
$ pip install [--user] petsc4py tao4py

Using distutils

Downloading

The TAO for Python package is available for download at the project website generously hosted by Bitbucket. You can use curl or wget to get a release tarball.

  • Using curl:

    $ curl -O https://bitbucket.org/dalcinl/tao4py/downloads/tao4py-X.Y.tar.gz
  • Using wget:

    $ wget https://bitbucket.org/dalcinl/tao4py/downloads/tao4py-X.Y.tar.gz

Building

After unpacking the release tarball:

$ tar -zxf tao4py-X.Y.tar.gz
$ cd tao4py-X.Y

the distribution is ready for building.

Some environment configuration is needed to inform the location of PETSc and TAO. You can set (using setenv, export or what applies to you shell or system) the environment variables TAO_DIR`, PETSC_DIR, and PETSC_ARCH indicating where you have built/installed TAO and PETSc:

$ export TAO_DIR=/usr/local/tao
$ export PETSC_DIR=/usr/local/petsc
$ export PETSC_ARCH=arch-linux2-c-opt

Alternatively, you can edit the file setup.cfg and provide the required information below the [config] section:

[config]
tao_dir    = /usr/local/tao
petsc_dir  = /usr/local/petsc
petsc_arch = arch-linux2-c-opt
...

Finally, you can build the distribution by typing:

$ python setup.py build

Installing

After building, the distribution is ready for installation.

If you have root privileges (either by log-in as the root user of by using sudo) and you want to install TAO for Python in your system for all users, just do:

$ python setup.py install

The previous steps will install the tao4py package at standard location prefix/lib/pythonX.X/site-packages.

If you do not have root privileges or you want to install TAO for Python for your private use, you have two options depending on the target Python version.

  • For Python 2.6 and up:

    $ python setup.py install --user
  • For Python 2.5 and below (assuming your home directory is available through the HOME environment variable):

    $ python setup.py install --home=$HOME

    Finally, add $HOME/lib/python or $HOME/lib64/python to your PYTHONPATH environment variable.

Table Of Contents

Previous topic

Tutorial

This Page