Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This article will explain how to set up the Miniconda Conda environment under a user’s HPC account.

In addition, this article will also show an example of a submission script that will show how to submit Miniconda job(s).

\uD83D\uDCD8 What is Miniconda?

Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others.

\uD83D\uDCD8 Downloading miniconda repo

#1

curl -L -O https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh

bash Miniconda3-py39_4.9.2-Linux-x86_64.sh -b -p ~/miniconda3

#2

With Miniconda installed to a user’s home directory, the PATH environment variable would need to be exported to add miniconda to the PATH environment variable:

export PATH=$HOME/miniconda3/bin:$PATH

\uD83D\uDCD8 Enabling the Miniconda environment

conda init bash

Log off of HPC terminal and log back into HPC.

The terminal prompt on HPC should change to look like the following:

(base) [netidhere@cn(or gpu) XXX ~]$

The (base) confirms miniconda installed successfully and is in the default Conda environment.

\uD83D\uDCD8 Setting up the Miniconda environment

Here is an example showing how to create a Conda environment called abinit to allow for a abinit install:

conda create --name abinit

Activate the conda environment

conda activate abinit

Terminal should change to look like the following:

(abinit) [netidhere@cn(or gpu) XXX ~]$

Install abinit in conda environment

Install abinit:

conda install abinit

or

conda install -c conda-forge abinit

The above should set up the Abinit environment with the needed dependencies.

Then a user should be able to call the abinit command(s) that are needed to run abinit successfully.

Deactivate conda environment

To deactivate the abinit conda environment, the following command can be entered:

conda deactivate

That will tell miniconda to go back to the (base) Conda environment and at that point a new Conda environment can be installed or activated.

Testing miniconda environment in an interactive Slurm fisbatch job

fisbatch -N 1 -n 24 -p general

conda activate condaenvironmentname

commands for conda/program run

To exit out of the Slurm Fisbatch job and end miniconda:

Type exit twice to exit out of the conda environment, and then exit out of the Fisbatch job.

User will be back on the login node they logged into HPC initially (login4, login5, login6)

Next time a user logs into HPC, the terminal will show the (base) [netidhere@cnXXX ~] on the login node.

\uD83D\uDCD8 Submission Script Example:

Here are the Bash Submission script steps to call the miniconda environment:

#!/bin/bash

#SBATCH --partition=partitionnamehere

#SBATCH -N 1

#SBATCH --n 24

module purge

module load modulesneededhere

source /home/yournetidhere/miniconda3/etc/profile.d/conda.sh

conda activate condaenvironment

softwarecommandhere

  • No labels