Skip to content

Anaconda

Anaconda is a distribution that makes it easy to manage Python and R programming environments within different domains. Suitable for Linux, macOS and Windows.

Licences

Anaconda has freemium license, miniconda is free.

Installation

Installation instructions are available at the link.

Install Miniconda3

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p /ceph/hpc/home/$USER/miniconda3/
mkdir ~/bin && ln -s /ceph/hpc/home/$USER/miniconda3/bin/conda ~/bin/conda
conda create --name pytorch_env python=3.10
conda activate pytorch_env

Check available modules

module avail Anaconda

Output

----------------------------------------------------------------------------------------------------------------------- /cvmfs/sling.si/modules/el7/modules/all ------------------------------------------------------------------------------------------------------------------------
   Anaconda3/2020.11    Anaconda3/2021.11    Anaconda3/2022.05    Anaconda3/2023.07-2 (D)

Load default module

module load Anaconda3

Create new environment named myenv for specific Python 3.10 version:

conda create --yes --name myenv python=3.10

Activate environment

conda activate myenv

List the environments

conda env list

Install packages via conda

conda install torch 

Install packages via pip

pip install torch

Update environment

conda env update --name myenv --file env.yml

Deactivate environment

conda deactivate myenv

Remove environment

conda env remove -n myen

SBATCH example

#!/bin/bash
#SBATCH -n 2
#SBATCH -N 2
#SBATCH -p cpu

module load Anaconda3
source activate myenv

python3 script.py

Adjust environment location in condarc

cat ~/.condarc

Output

channels:
  - defaults
ssl_verify: true
envs_dirs:
  - /ceph/hpc/home/$USER/anaconda_envs
pkgs_dirs:
  - /ceph/hpc/home/$USER/anaconda_envs

Documentation