Python

Python, a programming language, is available without modules. However, this version (2.7.3) might be too old or miss certain modules. Therefore, we have newer versions available. They can be accessed using the module command.

Type

module avail python

to see which Python versions are installed (e.g. 2.6.8, 2.7.2, 2.7.3, 2.7.9, 3.3.0, 3.4.2).

Usage

  • Load the python module, which gives you the default version:
module load python
  • Load a specific version, eg:
module load python/2.7.9
module load python/3.4.2
  • Note that Python 3 is used through the "python3" executable

Installed packages

Version 2.7.9 is the recommend version as it contains the most commonly used packages. The following packages are installed for Python 2.7.9:

affinegap (1.1)
appdirs (1.4.0)
argparse (1.3.0)
backports.ssl-match-hostname (3.4.0.2)
biopython (1.65)
bitarray (0.8.1)
BTrees (4.0.8)
bzr (2.6.0)
canonicalize (1.3)
categorical-distance (1.5)
certifi (2015.04.28)
cogent (1.5.3)
configobj (5.0.6)
Cython (0.21.2)
decorator (3.4.2)
dedupe (0.8.0.1.5)
dedupe-hcluster (0.3.2)
distribute (0.7.3)
docutils (0.12)
fann2 (1.0.7)
fastcluster (1.1.13)
fastlmm (0.2.4)
future (0.14.3)
h5py (2.5.0)
haversine (0.1)
HDDM (0.5.5)
ipython (2.3.1)
Jinja2 (2.7.3)
jsonschema (2.4.0)
kabuki (0.5.5)
libmagic (1.0)
MarkupSafe (0.23)
matplotlib (1.4.2)
melview (1.0.1)
Metafone (0.5)
mock (1.0.1)
mpi4py (1.3.1)
netCDF4 (1.1.7.1)
nibabel (2.0.0)
nose (1.3.4)
numexpr (2.4)
numpy (1.9.2)
pandas (0.16.1)
patsy (0.3.0)
persistent (4.0.9)
Pillow (2.7.0)
pip (1.5.6)
py (1.4.26)
pycrypto (2.6.1)
pyface (4.4.0)
Pygments (2.0.1)
PyLBFGS (0.1.6)
pymc (2.3.3)
pyparsing (2.0.3)
PySide (1.2.2)
pysnptools (0.2.3)
pysqlite (2.6.3)
pytest (2.7.0)
python-dateutil (2.4.2)
pytools (2014.3.5)
pytz (2015.4)
PyYAML (3.11)
pyzmq (14.6.0)
rlr (1.3)
scikit-learn (0.16.1)
scimath (4.1.2)
scipy (0.15.1)
setuptools (7.0)
simplecosine (1.0)
simplejson (3.6.5)
six (1.9.0)
Sphinx (1.2.3)
statsmodels (0.6.1)
Theano (0.7.0)
tornado (4.1)
traits (4.5.0)
traitsui (4.4.0)
virtualenv (12.1.1)
wsgiref (0.1.2)
zope.index (4.1.0)
zope.interface (4.1.2)

If you think we missed an important package, please request its installation by mailing to helpdesk@surfsara.nl.

Installing python packages

Here follows a recipe to install python packages:

As an example we demonstrate how to install the package `Gnuplot`.

Many packages are already installed, so try that first:

  • login to lisa
  • If you need the default installed version:
module load python
  • Start python:
python
  • Try to import Gnuplot:
import Gnuplot
Traceback (most recent call last):
File "", line 1, in 
ImportError: No module named Gnuplot

So, package `Gnuplot` is not installed. To install it:

  • login to lisa
  • If you need the default installed version of python:
module load python
  • Locate the package and download it to the system:
wget http://sourceforge.net/projects/gnuplot-py/files/Gnuplot-py/1.8/\
gnuplot-py-1.8.tar.gz/download
mv download gnuplot-py-1.8.tar.gz
  • extract the package:
tar xzvf gnuplot-py-1.8.tar.gz
  • change the directory:
cd gnuplot-py-1.8
  • Install the package:
python setup.py install --home=$HOME/pythonpackages

That is nearly all. The package is installed now in the directory 'pythonpackages' in your home directory. We advise to install all your python packages in this directory.

  • Now, you must tell python where to look for installed packages:
export PYTHONPATH=$HOME/pythonpackages/lib/python:$PYTHONPATH
  • Test if the package can be used:
python
>>> import Gnuplot
>>>

So, the installation was successful.

More information