Conda on AI.Panther

Overview

Conda allows you to create isolated software environments in your home directory.

On AI.Panther, you can use Conda in two ways:

  1. Load the cluster Anaconda module (recommended for most users)

  2. Install your own Miniforge in your home directory (self-managed option)

Conda environments can be created and used on both login nodes and compute nodes. The login node should only be used for very lightweight installs. GPU-enabled packages or large builds must be installed on a compute node.

Option 1: Using the Anaconda Module

Load the module:

module load anaconda3/2023.09-0-gcc-14.2.0-tpv4qnt
source $(conda info --base)/etc/profile.d/conda.sh

Verify:

conda --version

You can now create and activate environments:

conda create -n myenv python=3.13 -y
conda activate myenv
python --version

Install packages:

conda install -c conda-forge numpy scipy -y

Deactivate when finished:

conda deactivate

Note:

  • Always use conda activate <env>

  • Do not use source <env>/bin/activate

  • You must load the Anaconda module in each new shell session

If you want the module loaded automatically in interactive shells, add this to your ~/.bashrc:

module load anaconda3/2023.09-0-gcc-14.2.0-tpv4qnt >/dev/null 2>&1 || true

Option 2: Installing Miniforge (Self-Managed)

If you prefer a fully independent Conda installation, you can install Miniforge in your home directory.

From the login node:

cd ~
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
  • Accept the license
  • Use the default install location (~/miniforge3)

  • Allow shell initialization when prompted

After installation, start a new shell or run:

source ~/.bashrc

Verify:

conda --version

Source: https://github.com/conda-forge/miniforge

Installing Packages on Compute Nodes

Some packages - particularly those that:

  • Require GPUs

  • Build CUDA extensions

  • Perform heavy compilation

should be installed on a compute node, not the login node.

Interactive install on a compute node

srun -p gpu1 --nodes=1 --ntasks=1 --mem=10G --time=01:00:00 --pty bash -l

Then activate conda and install:

conda activate myenv
conda install -c conda-forge <package>

Installing from an environment file (recommended for complex setups)

If you have an environment.yml:

srun --partition=short mamba env create -y --file environment.yml

Notes:

  • This ensures the environment is built under Slurm resource limits

  • mamba is faster and recommended for larger dependency graphs

  • The environment will be created in your conda installation


Best Practices

  • Use the login node for:

    • Creating environments

    • Light installs

    • Managing environment files

  • Use compute nodes for:

    • GPU-enabled packages

    • Large or long installs

  • Keep one environment per project when possible