At the Tartu HPC cluster I have a limit for number of files, which prevents me from having too many conda environments. So, after I have ruined my base environment, I decided to finally switch to Singularity/Apptainer. Here is a simple recipe for creating an apptainer which is equivalent to standard conda installation. It is just an example. Note that AMD/Intel optimized apptainers will run 10–20% faster than the conda one.
P.S. I have ruined my base environment while trying to install XMGRACE, which is so much easier to use than writing a python code just to check calculations results.
Bootstrap: docker
From: continuumio/miniconda3
%post
# Install necessary packages including InfiniBand support using apt
apt-get update && \
apt-get install -y infiniband-diags perftest ibverbs-providers libibumad3 libibverbs1 libnl-3-200 libnl-route-3-200 librdmacm1 lldpad libdapl2 libdapl-dev rdmacm-utils ibverbs-utils && \
apt-get install -y grace povray && \
rm -rf /var/lib/apt/lists/*
# Configure conda
conda install --solver=classic conda-forge::conda-libmamba-solver conda-forge::libmamba conda-forge::libmambapy conda-forge::libarchive
conda install -y python=3.11
# Install openmpi and ucx from conda
conda install -y -c conda-forge openmpi=4.1.6=*hc5af2df* ucx
# Install gpaw from conda
conda install -y -c conda-forge gpaw=24*=*openmpi*
# Install other packages
conda install -y -c conda-forge dftd4 dftd4-python
# Optionally, clean up Conda to reduce the image size
conda clean --all -f -y
%environment
# Activate the base environment
source /opt/conda/etc/profile.d/conda.sh
conda activate base