Directly from [1]: Anaconda is a distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment.

Loading the Module

module load Anaconda3/2020.07

Getting Started

  •  Create your Environment

Use the conda create command to build a virtual environment. Although by default, the environment files are saved to '/home/<username>/.conda/envs'  directory, it is highly recommended to store the environment files in your dedicated research storage area and NOT in your home directory. Please note that installing these files and other packages in your /home directory will result in a full home folder which will lock you out of the cluster. You can specify the other location with the help of --prefix the option in the command.

You should set meaningful environment names for easy readability. It is recommended to specify as many packages as possible at environment creation time. However, once a Conda environment is created, a user can still install additional packages using either conda install or pip install. (use pip ONLY if the packages are unavailable through conda)

– With conda

$ conda create --name=env_name <package1><package2>....<pacakgeN>

For example,

$ conda create --prefix=doit_user/ada_envs/torch-env jupyter pytorch torchvision torchaudio torchtext cudatoolkit=11.0 -c pytorch
  • Use Your Environment

Run the following commands to activate and use the environment :

conda activate env_name

To deactivate the environment :

conda deactivate

Installing Packages

You can install required packages using conda or pip. Attempt to install packages as much as possible with conda, then use pip if the packages are unavailable through conda.

– With conda

To install a specific package into an existing current environment “env_name”, use the following :

conda install <package-name>

If you want to install the package in a specific  environment, mention the required environment name using the below command :

conda install --name env_name <package-name>

– With pip

If a package isn’t offered by conda or, you might be able to find and install it using another package management, such as pip.

To use pip for installation into an existing environment, run :

pip install <package-name>

Additional Conda Commands

List all of your environments :
conda info --envs orconda env list
Delete a Conda Environment :
conda remove --name <environment-name> --all orconda env remove --name <environment-name>
View a list of packages installed in an environment:

If the environment is already activated, run

conda list orconda list -n <environment-name>

Understanding Storage of conda packages

The environment files are saved by default in the directory ‘/home/username>/.conda/envs‘ The --prefix option in the command allows you to specify other locations.