How to use Python on Seawulf

This KB Article References: High Performance Computing
This Information is Intended for: Instructors, Researchers, Staff
Created: 04/03/2017 Last Updated: 05/15/2024

Current Version

Three versions of python are currently available on Seawulf: a standard distribution of python 2.7, along with python 2, and python 3 managed through Anaconda. 

Anaconda2 and Anaconda3 are installed on Seawulf. If your script requires python 2, run:

module load anaconda/2

If your script requires python 3 and does not use MPI, run:

module load anaconda/3

 

To ensure that you are executing the correct version, type which python to confirm that Anaconda2 or 3 is loaded:

which python

/gpfs/software/Anaconda2/bin/python

You can also confirm that you are running the correct python version by typing python --version.


MPI with Python

Anaconda2 and Anaconda3 are used to manage packages.   These versions come with many commonly used scientific computing libraries.

For multi-node programming in Python, mpi4py is installed.  A python script must interface with this package to run across nodes.  Example scripts can be found here, and in our examples folder:

/gpfs/projects/samples/python

To launch a Python  job using Slurm that requires python 2, load the following modules:

module load slurm
module load anaconda/2 
module load mvapich2/gcc/64/2.2rc1

If your Python job requires python 3, load the following modules:

module load slurm
module load mpi4py/3.0.3
module load mvapich2/gcc/64/2.2rc1

To run your script, use mpirun:

mpirun python my_script.py

For More Information Contact


IACS Support System

Still Need Help? The best way to report your issue or make a request is by submitting a ticket.

Request Access or Report an Issue