This is a short guide explaining how to use conda to create your own Python environment and run custom code on the FAITH cluster.
We will not cover all features of conda — for a more complete introduction, please refer to:


Step 1 — Create a Virtual Environment

First, log in to the master node of the FAITH cluster. From your home directory, create a new virtual environment named mytests by running:

conda create -n mytests python numpy pandas

This command will create a conda environment named mytests and install python, numpy, and pandas into it.


Step 2 — Initialize Conda and Activate the Environment

1️ Initialize conda:

conda init

Note: After running conda init, you should exit your SSH session and open a new one for changes to take effect.

2️ Activate your new environment:

source activate mytests

3️ Verify the environment and installed packages:

conda list

You should see a list of installed packages, including python, numpy, and pandas.

4 Exit your environment:

conda deactivate

You should see a list of installed packages, including python, numpy, and pandas.

💡 Note on Where to Create the Environment

For simple environments, it is fine to create them directly on the master node. However, for more complex environments (e.g., using GPU support, hardware-specific optimizations), it is recommended to create the environment directly on the compute node. This can help avoid hardware compatibility issues and improve performance when running jobs.


Step 3 — Encapsulate Everything in a SLURM Script

Now, we will create a simple SLURM batch script to run your code inside the conda environment.

Create a file named example-miniconda.sh with the following content:

#!/bin/bash
#SBATCH --job-name=sleep                # Job name
#SBATCH --mail-type=END,FAIL            # Mail events (NONE, BEGIN, END, FAIL, ALL)
#SBATCH --time=00:05:00                 # Time limit hrs:min:sec
#SBATCH --output=output_%j.log          # Standard output and error log
#SBATCH --ntasks=1
#SBATCH --partition=GPU
#SBATCH --nodelist=diufrd204
#SBATCH --cpus-per-task=1

echo "Display the host name"
pwd; hostname; date

echo "Just checking the version of Python on the server"
python --version

echo "Activate my local env."
source activate mytests

echo "List the installed packages"
conda list

echo "Just checking the version of Python in the local environment"
python --version

echo "You can put your custom code here if you like, executed inside the virtual env."

echo "Leaving the local environment"
conda deactivate
date

Submit the job:

sbatch example-miniconda.sh

Example Output

After successful execution, you should see an output file similar to:

Display the host name
/HOME/elbetjal
diufrd204
Wed Jun 18 15:24:25 CEST 2025
Just checking the version of Python on the server
Python 3.12.9
Activate my local env.
List the installed packages
# packages in environment at /HOME/elbetjal/.conda/envs/mytests:
#
# Name                Version          Build  Channel
...
numexpr               2.10.1           py313h3c60e43_0
numpy                 2.2.5            py313h8d96ed3_0
numpy-base            2.2.5            py313h8e760e0_0
...

Just checking the version of Python in the local environment
Python 3.13.5

You can put your custom code here if you like, executed inside the virtual env.

Leaving the local environment
Wed Jun 18 15:24:27 CEST 2025

Summary

  • You now have a simple conda environment (mytests) with your own packages.

  • You know how to activate and use it interactively or inside a SLURM batch job.

  • For more advanced usage, consult the official Conda documentation.