You need to have the following software properly installed in order to build SLEPc for Python:
[1] | Unless you have appropiatelly configured and built SLEPc 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). |
If you already have a working PETSc, set environment variables PETSC_DIR and perhaps PETSC_ARCH to appropriate values:
$ export SLEPC_DIR=/path/to/slepc
$ export PETSC_DIR=/path/to/petsc
$ export PETSC_ARCH=linux-gnu
Note
If you do not set these environment variables, the install process will attempt to download and install PETSc for you.
Now you can use pip:
$ [sudo] pip install [--user] slepc4py
Alternatively, you can use setuptools easy_install (deprecated):
$ [sudo] easy_install slepc4py
The SLEPc for Python package is available for download at the project website generously hosted by Google Code. You can use wget to get a release tarball:
$ wget http://slepc4py.googlecode.com/files/slepc4py-X.X.X.tar.gz
After unpacking the release tarball:
$ tar -zxf slepc4py-X.X.X.tar.gz
$ cd slepc4py-X.X.X
the distribution is ready for building.
Some environmental configuration is needed to inform the location of PETSc and SLEPc. You can set (using setenv, export or what applies to you shell or system) the environmental variables SLEPC_DIR`, PETSC_DIR, and PETSC_ARCH indicating where you have built/installed SLEPc and PETSc:
$ export SLEPC_DIR=/usr/local/slepc/3.1
$ export PETSC_DIR=/usr/local/petsc/3.1
$ export PETSC_ARCH=linux-gnu
Alternatively, you can edit the file setup.cfg and provide the required information below the [config] section:
[config]
slepc_dir = /usr/local/slepc/3.1
petsc_dir = /usr/local/petsc/3.1
petsc_arch = linux-gnu
...
Finally, you can build the distribution by typing:
$ python setup.py build
After building, the distribution is ready for installation.
You can do a site-install type:
$ python setup.py install
or, in case you need root privileges:
$ su -c 'python setup.py install'
This will install the slepc4py package in the standard location prefix/lib/pythonX.X/site-packages.
You can also do a user-install type. Threre are 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
and then add $HOME/lib/python or $HOME/lib64/python to your PYTHONPATH environment variable.