Conda Virtual Environments: How to Build Using Miniforge
This information is part of a collection of information on building and using virtual environments.
ARC suggests the use of Miniforge as the preferred way to build conda virtual environments (CVEs). We recommend not to install andaconda on your home as suggested on traditional tutorials. ARC’s provided Miniforge will work faster than user-installed anaconda in $HOME.
Steps for Building a Conda Virtual Environment (CVE)
Create an interactive session to a compute node.
interact --account=<account> --mem 16G
Load Miniforge3.
module load Miniforge3
Create a CVE with a given name. Optionally, specify the python version.
conda create -p ~/path/to/env/<name of CVE> python=3.12
Activate the newly-created CVE.
source activate ~/path/to/env/<name of CVE>
Install package(s) to the CVE. You can install multiple packages (package names separated by commas).
conda install <package_name>
Sometimes, packages are not available via conda install
. Alternatively, you may use pip install
.
pip install <package_name>
Deactivate the CVE.
conda deactivate
Terminate the interactive session on the compute node.
exit