Python is well suited to do preparation and post-processing for jobs, but is not as suited for high-performance computing as a compiled language like C or Fortran. We do not recommend that users use it for a major component of their HPC jobs. We do recommend using it for preparation, post-processing, and proof-of-concept work for defining algorithms.
Using modules we have several full-featured versions available. A current list of Python versions (and other software) can be found by running this command:
module avail python
To load Python using modules:
# load Python 3.7.x module load python/3.7 # switch to Python 3.6.x module swap python/3.6
TensorFlow and Keras
At the time of this writing TensorFlow 1.2 and Keras 2.0 are installed via the. In order to use TensorFlow or Keras you will also need these three modules (loading them in this order is important):
A GPU is also required. Add
--gres=gpu:n to your
salloc command where n is the number of GPUs you need per node. At the moment we have up to 4 GPUs per node.
If you need to install a library that you anticipate being the only user of, we recommend that it be installed in your own directory somewhere.
With pip you can do this by running the following command after you have loaded the relevant environment module for Python (eg
pip install --user package
You can also install everything relative to an alternate prefix directory, such as one within a group directory:
pip install --prefix=directory-to-install-to package
For example if you have a top level directory:
~/fsl_groups/fslg_somegroup/.local you can use pip to install packages to
~/fsl_groups/fslg_somegroup/.local/lib. You will then need to add the following two lines to your
export PATH="$HOME/fsl_groups/fslg_somegroup/.local/bin:$PATH" export PYTHONPATH="$HOME/fsl_groups/fslg_somegroup/.local/lib/python3.7/site-packages"
python3.7 with the appropriate version number for Python, like
You can run
pip help install for more options and help.
If the project does not use pip, you can tell Python to use your home directory:
python setup.py install --user package
If it is a library that a large set of users will use or if it requires some specialized compiling, please open a support ticket.
The following packages are available for each version of Python in the module list:
To follow these instructions, you will need to be on a Unix-like operating system (macOS, Linux, etc.), not Windows. We've had some success with Windows Subsystem for Linux. Before continuing, we suggest setting up SSH multiplexing and setting up public-key authentication within the cluster.
To use Jupyter notebooks on our systems, you'll want to install Jupyter via pip, as detailed above:
pip install --user jupyter # Base Juptyer system pip install --user jupyterlab # Includes updated user interface
Pip should install Jupyter into a
; you may need to adjust your PATH environment variable to include Jupyter executables.
Jupyter works by connecting to your browser. To facillitate this, you'll need to run some commands from both your computer and our systems. We'll use
$ to represent commands that should be executed on our systems, and a
> to indicate commands that should be run on your computer.
In terminal 1:
# Connect to our systems > ssh email@example.com # Request 1 cpu and 1GB of memory for an hour for an interactive job $ salloc --mem-per-cpu=10240M --ntasks=1 --nodes=1 --time=1:00:00 # Get the hostname of the compute node you've been allocated, and note it for later commands $ echo $HOSTNAME # Start up Juptyer on a random port to avoid possible collisions $ jupyter notebook --no-browser --port $(($RANDOM+32767)) # Note the port Jupyter uses in its output and replace with $PORT in subsequent commands
In terminal 2:
# Set up port forwarding to Jupyter > ssh -N -J firstname.lastname@example.org -L $PORT:localhost:$PORT hostname
From here, you'll want to open your browser per the Jupyter's output.
Voila! Jupyter should be working. When you're done, be sure to kill Juptyer and log out of both terminals to relinquish resources back to Slurm.