Conda

Guidance last updated: 20 October 2026

Conda manages environments containing Python and other software dependencies. Use it when your project needs packages or non-Python dependencies supplied by Conda channels. The Anaconda module provides Conda on Stanage. For a personal installation, see Miniforge (recommended).

For ordinary Python projects and environments using HPC module-provided packages such as mpi4py, see Python on Stanage.

Loading Conda

After connecting to Stanage (see Establishing a SSH connection), start an interactive session:

salloc

Anaconda Python can be loaded with one of the following:

module load Anaconda3/2025.06-1
module load Anaconda3/2024.02-1
module load Anaconda3/2022.10
module load Anaconda3/2022.05
module load Anaconda3/2021.11
module load Anaconda3/2020.11
module load Anaconda3/2019.07

The shared base Conda environment includes Python and other packages. Create your own environment to install or change packages; do not modify the shared installation.

Initialise Conda’s shell functions after loading the module:

source "$EBROOTANACONDA3/etc/profile.d/conda.sh"

This enables conda activate and conda deactivate in the current shell, including batch jobs, without running conda init.

Creating a Conda Environment

These examples explicitly select conda-forge. --override-channels prevents other configured channels from being used for these commands.

Conda environments share files with the package cache using hard links where possible; copies may be required when the cache and environment are on different filesystems.

To create an environment with Python 3.13, NumPy and pip you can run:

conda create --override-channels --channel conda-forge -n mynumpy python=3.13 numpy pip

This installs compatible Python 3.13 and NumPy packages and creates an environment named mynumpy.

You can request specific versions of Python and packages, provided they are available from conda-forge:

conda create --override-channels --channel conda-forge -n myscience python=3.13 numpy scipy pip

If you wish to modify an existing environment, such as one of the anaconda installations, you can clone that environment:

conda create --override-channels --channel conda-forge --clone myscience -n myexperiment

This will create an environment called myexperiment which has all the same conda packages as the myscience environment.

How to avoid large conda environments filling up your home directory

Home directories have limited space and can often reach their quota limit. Conda environments exponentionally take up space, if you have or want to create one or more large Conda environments (e.g. containing bulky Deep Learning packages such as TensorFlow or PyTorch) then there’s a risk you’ll quickly use up your home directory’s storage quota.

To avoid this, build your conda environments in a fastdata area

  1. Create a .condarc file in your home directory if it does not already exist.

  2. Add an envs_dirs: and pkgs_dirs: section to your .condarc file as shown below:

pkgs_dirs:
- /mnt/parscratch/users/$USER/anaconda/.pkg-cache/

envs_dirs:
- /mnt/parscratch/users/$USER/anaconda/.envs
  1. We recommend users create their own personal folder in the /fastdata area. As this doesn’t exist by default, you can create it with safe permissions. See fastdata area

  2. Then create .envs and .pkg-cache directories in your fastdata area as shown below:

mkdir -p /mnt/parscratch/users/$USER/anaconda/.pkg-cache/  /mnt/parscratch/users/$USER/anaconda/.envs

Installations of environments and package caching should now occur in your fastdata area

Using conda Environments

Once the conda module is loaded you have to load or create the desired conda environments. For the documentation on conda environments see the conda documentation.

You can load a conda environment with:

conda activate myexperiment

where myexperiment is the name of the environment, and unload one with:

conda deactivate

which will return you to the previous environment.

It is possible to list all the available environments with:

conda env list

Installing Packages Inside a Conda Environment

Once you have activated your own environment you can install additional packages or different versions of packages into it. There are two methods for doing this, conda and pip, if a package is available through conda it is strongly recommended that you use conda to install packages. You can search for packages using conda:

conda search --override-channels --channel conda-forge pandas

then install the package using:

conda install --override-channels --channel conda-forge pandas

if you are not in your environment you will get a permission denied error when trying to install packages, if this happens, create or activate an environment you own.

If a package is not available through Conda, search for it on PyPI and install it in your activated environment:

python -m pip install colormath

Install Conda packages first, then use pip for any remaining packages.

Using Conda and Python in a batch job

Create an example batch submission script called myscript.slurm that is similar to the following:

#!/bin/bash
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=2000
#SBATCH --time=10:00

export SLURM_EXPORT_ENV=ALL
module load Anaconda3/2025.06-1
source "$EBROOTANACONDA3/etc/profile.d/conda.sh"

# We assume that the conda environment 'myexperiment' has already been created
conda activate myexperiment
srun python mywork.py

Then submit this to Slurm by running:

sbatch myscript.slurm

Further Conda Python Learning Resources

The resources and training courses below may be of interest:

Installing a personal copy of Conda

Miniforge is recommended for a new personal installation. It includes Conda and Mamba and uses conda-forge as its default package channel, matching the examples on this page. Miniconda remains an alternative.

Miniconda (alternative)

If you need Miniconda, follow the official Miniconda installation instructions and install it into $HOME/software/installs/miniconda. Do not initialise your shell during installation or run conda init afterwards.

In a session without another Conda installation loaded or activated, enable its shell functions and activate it with:

source "$HOME/software/installs/miniconda/etc/profile.d/conda.sh"
conda activate base

Use the explicit --override-channels --channel conda-forge commands above when creating environments or installing packages from conda-forge.

Installation notes

Anaconda3

Anaconda3 was installed using Easybuild, build details can be found in $EBROOTANACONDA3/easybuild with a given module loaded.