Using Python on Cholesky

The Python we provide on Cholesky cluster (and on Hedin, Hopper, Tianlong, Montblanc nodes) is Anaconda Python. Anaconda provides a good compromise between productivity and performance.

Most of Python users are using custom conda environments you might find that these are a good solution for you, too.

If you have Python questions or problems, please contact Cholesky's support team. We also encourage you to take a look at our FAQ page.

How to use Python on Cholesky

There are 3 options for using and configuring your Python environment on Cholesky cluster. We provide a brief overview here and will explain each option in greater detail below.

  1. Module only
  2. Module + conda activate (most popular)
  3. Using a singularity container (under construction)

Option 1: Module only

In this mode, you just module load anaconda3 and use it however you like. This is the simplest option but also the least flexible. If you require a package that is not in our default modules this option will not work for you.

$ module load anaconda3

Who should use Option 1?

Option 1 is best for users who want to get started quickly and who do not require special libraries or custom packages.

Option 2: Module + conda activate

In this mode, you first module load anaconda3 and then build and use a conda environment on top of our module. To use this method :

$ module load anaconda3
$ conda activate myenv

To leave your environment:

$ conda deactivate

and you will return to the base Python environment.

To create a custom environment using Option 2:

$ module load anaconda3
$ conda create --name myenv python=3.11
$ conda activate myenv
$ conda install <your package>

Who should use Option 2?

This is our most popular option. It is good for anyone who would like to use packages that not avaible in the Python module.

Using MPI for Python

If you use MPI for Python / mpi4py package, do not install it with the conda command but with pip install command, loading the gcc and openmpi 4.1.4 modules beforehand. Please read this procedure.

Option 3: Using a singularity container

Under construction...

Using MPI for Python on Cholesky

Using the MPI for Python aka MPI4PY package on the Cholesky cluster requires your attention. Indeed, the openmpi 4.1.4 module has been compiled to run on all SLURM partitions (cpu_dist, tianlong*, montblanc*, hedin*, hopper*) via its mpilaunch wrapper. It is therefore necessary to rely on this module to install the mpi4py package in your python environment. To do this, you must first load the openmpi/4.1.4 module before installing the mpi4py package with the pip install command:

$ module load gcc
$ module load openmpi/4.1.4
$ module load anaconda3
$ conda create --name myenv python=3.11
$ conda activate myenv
$ pip install mpi4py
$ conda install <your package>

MPI for Python on Tianlong, Hedin, Montblanc and Hopper partitions

Python users of the mpi4py package on theses partitions might run into issues with the default configuration of mpi4py. The mpi4py package is using matching probes (MPI_Mpobe) for the receiving function recv() instead of regular MPI_Recv operations per default. These matching probes from the MPI 3.0 standard however are not supported for all InfiniBand Fabrics, which may lead to a hang in the receiving function. You might alternatively switch off the usage of matching probe operations within the mpi4py recv() function. This can be established by setting MPI4PY_RC_RECV_MPROBE environment variable to 0 (export MPI4PY_RC_RECV_MPROBE=0) in your sbatch script or set mpi4py.rc.recv_mprobe = False after importing the mpi4py package in your python source file.