Skip to content

Using Anaconda on AAC

This page explains how to set up and use the Anaconda Python distribution on AAC clusters.

Availability

Important: The Anaconda module is currently available on MI325X only. It is not yet deployed on MI355X.

If you need Anaconda on MI355X, please contact your AMD sponsor or cluster operations team.

Set up an Anaconda environment

Step 1: Allocate a node

salloc --reservation=<Reservation_Name> --exclusive --mem=0 --gres=gpu:8 -p <Partition_Name> --account=<ACCOUNT_NAME>

Example:

salloc --reservation=<Reservation_Name> --exclusive --mem=0 --gres=gpu:8 -p 256C8G1H_MI325X_Ubuntu22 --account=myteam

Step 2: Load the Anaconda module

After allocating a node, load the Anaconda module:

module load anaconda3/25.5.1

Step 3: Verify the installation

Verify that conda is available:

which conda
# Expected output: /shared/apps/anaconda3/25.5.1/bin/conda

conda --version
# Expected output: conda 25.5.1

Step 4: Initialize conda (first time only)

If conda activate doesn't work, initialize conda for your shell:

conda init bash
# Then logout and login again, or source ~/.bashrc
source ~/.bashrc

Step 5: Accept Terms of Service

When creating your first environment, you may need to accept conda's Terms of Service:

conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r

Step 6: Create your conda environment

# Create environment with specific Python version
conda create -n myenv python=3.10 -y

# Example: Create PyTorch environment
conda create -n pt-stable python=3.10.12 -y

Step 7: Activate the environment

conda activate myenv

Step 8: Install packages

# Load the recommended ROCm module
module load rocm/7.2.0

# Install PyTorch for ROCm 7.2
pip3 --no-cache-dir install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm7.2
# Or install from conda repositories
conda install pytorch torchvision torchaudio -c pytorch

# Install additional packages via pip
pip install transformers

Using Anaconda

Managing conda environments

List all environments

conda env list

Activate an environment

conda activate myenv

Deactivate environment

conda deactivate

Remove an environment

conda env remove -n myenv

Using Anaconda in Slurm jobs

Interactive session

# Allocate a node on MI325X
salloc --reservation=<Reservation_Name> -p 256C8G1H_MI325X_Ubuntu22 --gres=gpu:8 --mem=0 --exclusive --account=<ACCOUNT_NAME>

# Example:
salloc --reservation=<Reservation_Name> -p 256C8G1H_MI325X_Ubuntu22 --gres=gpu:8 --mem=0 --exclusive --account=myteam

# Load Anaconda
module load anaconda3/25.5.1

# Activate your environment
conda activate myenv

# Run your code
python train.py

Batch job

Create an SBATCH script:

#!/bin/bash
#SBATCH -J conda_job
#SBATCH -p 256C8G1H_MI325X_Ubuntu22
#SBATCH --gres=gpu:8
#SBATCH --mem=0
#SBATCH -N 1
#SBATCH --account=<ACCOUNT_NAME>
# Example: --account=myteam

# Load modules
module load anaconda3/25.5.1
module load rocm/7.2.0

# Activate conda environment
conda activate myenv

# Run your application
python train.py

Submit the job:

sbatch my_job.sbatch

Best practices

  1. Create environment in $HOME: Conda environments are stored in $HOME/.conda/envs by default, which persists across sessions.

  2. Use environment.yml for reproducibility: ```bash # Export current environment conda env export > environment.yml

# Recreate environment from file conda env create -f environment.yml ```

  1. Keep environments lean: Only install necessary packages to save storage quota.

  2. Combine with ROCm: For GPU workloads, load both Anaconda and ROCm modules: bash module load anaconda3/25.5.1 module load rocm/7.2.0

  3. Clean up unused packages: bash conda clean --all

Troubleshooting

Storage quota issues

If you encounter storage quota errors:

# Check conda cache size
du -sh ~/.conda

# Clean package cache
conda clean --packages --tarballs

Module not found on MI355X

If you try to load Anaconda on MI355X and get an error:

module load anaconda3/25.5.1
# Error: Unable to locate a modulefile for 'anaconda3/25.5.1'

This is expected. Anaconda is currently only available on MI325X. Use containers with Python/Anaconda pre-installed on MI355X, or request Anaconda deployment from cluster operations.

Alternative: using containers

If Anaconda is not available on your cluster or you need specific Python versions, consider using containers:

# PyTorch container with conda-like environment
srun --container-image=docker://rocm/pytorch-training:v25.5 \
  --container-mounts=$HOME:/workdir \
  --container-workdir=/workdir \
  python train.py

See Using Enroot with Pyxis for more container options.