Conda
Anaconda python distribution from Continuum Analytics (Conda) is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.
Here is how you typically initiate an environment and install packages:
$ module load anaconda3/2024.2 $ conda create --name myenv <package-1> <package-2> ... <package-N> $ conda activate myenv
When creating environments, it's efficient to include all necessary packages at once to ensure that dependencies are resolved together. Adding packages later is feasible but might complicate dependency management. Exiting an environment is simple with conda deactivate
.
To specify a new environment location, use the --prefix
or -p
option followed by the path to the directory where you want to create the environment (ex. project space).
Frequently Used Conda Commands
View the help menu:
$ conda -h
Help for the install command:
$ conda install --help
Search for a specific package in the conda-forge channel:
$ conda search cudatoolkit --channel conda-forge
Display all packages installed in the current environment (add --explicit
for complete paths):
$ conda list
Example commands to create environments and install specific packages:
$ conda create --name myenv pairtools
$ conda create --name myenv python=3.8 cudatoolkit
$ conda create --name bioconda-env bioconda-utils --channel bioconda
$ conda create --name baz-env bazel --channel powerai
Activate an existing environment and install a package:
$ conda activate bioconda-env
$ conda install pandas
List all environments:
$ conda info --envs
Delete an environment:
$ conda remove --name bioconda-env --all
Much more can be done with conda as a package manager or environment manager.
Useful links: