Python

Python is available on the system, with the typical packages such as Numpy and SciPy.  It is used by simply typing 'python' (this is version 2.6).  Python 2.7 is available with 'python27'. 

If you need a lot of additional packages, or some built in enhancements, or the latest python and packages, installing your own copy might be best.  See below!

Anaconda Python (recommended option)

Anaconda Python is another option and lets users to install relevant packages that they need in their home directories easily. Anaconda python can be downloaded from https://www.anaconda.com/download/#linux (choose Linux 64 bit). After downloading, simply run the installation script for setup in your home directory. 

Copy the link address for the Linux 64-bit installer. Follow instructions in the cluster, for example:

wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh 

bash Anaconda3-5.2.0-Linux-x86_64.sh

Click through the installer screens and accept license terms.

Make sure to include the Anaconda Python in your PATH environment variable. For example, include the following lines in your .bashrc, or .profile

export PATH="/home/anaconda/bin:$PATH"

You can then install many of the packages by the conda install command. For example

conda install numpy

conda install scipy

conda install mkl # Use Intel MKL libraries for numpy/scipy (recommended)

To run a job in the queue, you can write a simple script

#!/bin/bash
#PBS -l nodes=1:ppn=1
# serial job on knot
cd $PBS_O_WORKDIR
python myfile.py

or on pod (in Slurm)

#!/bin/bash
#SBATCH -N 1 -n 1
cd $SLURM_SUBMIT_DIR
python myfile.py

 

 

An older way - notes still here if you're using it - Another option is Canopy, which includes quite a few extra packages (e.g. ipython) and provides you with a IDE.  If you want to useCanopy, first run the installer which will put it in your directory by

 

    bash  /sw/csc/canopy-1.5.2-full-rh5-64.sh

this will actually take several minutes to do, so go do something else for a moment while it works.  If you'll want to run jobs in the queue, you also need to set it up so that the Canopy python becomes your default - do this by

    ~/Canopy/canopy_cli setup ~/canopy --set-default

This will also take some time to process, so go get lunch while it runs. Once it is installed, you run Canopy (for the GUI) by

~/Canopy/canopy 

and if you've run the ' ~/Canopy/canopy_cli setup ~/canopy --set-default' then any time you use python, you'll be using the Canopy version (you can verify this by typing 'which python').