Python

Python is installed on the cluster for users. There are many packages that extend Pythonís standard functionality. While we try to satisfy all requests for specific Python packages, we may not be able to meet your needs for various reasons. You can follow the directions below to help you install Python packages on your own.

How to view the packages that are installed in python

You will find many common packages already installed:

python27-extras module
atlas-sse3/atlas-sse3-devel
numpy
scipy
nose
sphinx
PyDICOMM
nibabel
scikit-learn
statsmodels
mne

To see a full list of packages you can run python and use the following command: >>> help("modules")


How to run Python in interactive mode

If you want to use Python interactively, then you would want to request an interactive pbs job and load the appropriate modules.:

[<username@headnode> ~]$ qsub -I -X -l nodes=1:ppn=1
qsub: waiting for job <some job name> to start
qsub: job <some job name> ready
[<username@compute node> ~]$
[<username@compute node> ~]$ module load python27
[<username@compute node> ~]$ module load python27-extras

How to run Python in pbs batch job

th

How to install packages locally

easy_install is a tool that automatically searches for your package at pypi.org, an online repository, downloads the files, and then installs them for you. To install packages in the default location, easy_install requires you to have special permissions. Fortunately, there are several ways to control the default location, and --user is the easiest option (run easy_install --help to see the others). For example, this is how one might install <package name> in their home directory:

[<username@headnode> ~]$ qsub -I -X -l nodes=1:ppn=1
qsub: waiting for job <some job name> to start
qsub: job <some job name> ready
[<username@compute node> ~]$
[<username@compute node> ~]$ module load python27
[<username@compute node> ~]$ module load python27-extras
[<username@compute node> ~]$ easy_install --user <package name>

With this command, <package name>is installed to ~/.local/lib/python2.7/site-packages, which is a directory Python automatically looks for when loading Python packages. If you have the package source code, and you want to install the package using its setup.py script, then you can use this flag as well:

[<username@compute node> ~]$ python setup.py build
[<username@compute node> ~]$ python setup.py install --user

If your package installs scripts, then you will want to load the module python_modules/local, which simply prepends $HOME/.local/bin to your PATH environment variable. In other words, it tells the shell/terminal where to look for your scripts.

-- David Pane - 2015-07-16

Comments

Topic revision: r1 - 2015-07-16 - dpane
 
This site is powered by the TWiki collaboration platform Powered by PerlLegal Info | www.cmu.edu | © 2016 Carnegie Mellon University