Skip to main content

Python and Conda

In addition to the operating system ditribution of Python, MCMeSU supercomputer provides specific versions of Python and Anaconda distributions that can be loaded by means of the software module system.

Working with Conda​

General information on using Conda are available in the Official User Guide of Conda and a reminder of the most useful commands can be found in the Conda Cheatsheet.

Module loading​

Before using the conda tools and environments, you must first load the appropriate module, chosen with module avail :

module load conda/2025.12

Initialization​

By default, Conda requires you to run conda init so that your shell environment is initialized. On MCMeSU, we stronly recommend to move this initilization code in a separate file so that it is not loaded automatically.

The content below can be written in a file named conda.env :

# This file replaces the initilization code created by 'conda init' in your .bashrc
#
# To use conda :
# 1. Load the desired module : module load conda/2025.12
# 2. Check that the version specified in this file is the same, change it if not
# 3. Load this file : source $HOME/conda.env
#

VERSION=2025.12

# >>> conda initialize >>>
__conda_setup="$(/softs/tools/conda/${VERSION}/bin/conda shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/softs/tools/conda/${VERSION}/etc/profile.d/conda.sh" ]; then
. "/softs/tools/conda/${VERSION}/etc/profile.d/conda.sh"
else
export PATH="/softs/tools/conda/${VERSION}/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<

Creation of your conda environment​

After having performed the initialization steps above (module loading and conda.env sourcing) :

$ conda create -p /path/to/your/new/env numpy boost alabaster vtk
Fetching package metadata ...........

The following NEW packages will be INSTALLED:

alabaster: 0.7.10-py27he5a193a_0
boost: 1.65.1-py27_4
bzip2: 1.0.6-h6d464ef_2
ca-certificates: 2017.08.26-h1d4fec5_0
certifi: 2018.1.18-py27_0
...
info

For package installation, we stronly recommend using the 'mamba' command instead of the 'conda' command. Also, we strongly recommend to perform the environment creation in a Slurm interactive job to avoid overloading the login nodes.

To activate or deactivate a newly created Conda environment, you may use source activate and source deactivate :

$ source activate /path/to/your/new/env

(newEnv) [user@mc-login1 ~]$ source deactivate

Using your conda environment​

Within a job script, the following steps must be performed in order for your environment to be loaded :

module load conda/2025.12
source $HOME/conda.env
source activate /path/to/your/new/env
info

If you want to use a different version of Conda, adapt the module load line and the VERSION field within the 'conda.env' file.