Conda and Mamba
Last updated
Was this helpful?
Last updated
Was this helpful?
Both the miniconda3 and minforge modules include only conda, python, and a few other packages. Only the miniforge module provides mamba.
Mamba is a drop-in replacement of conda, and is faster at resolving dependencies than conda. For commands like conda install
and conda search
, conda
can be replaced with mamba
on Oscar. More details can be found in .
It is not recommended to initialize conda via conda init
.
To access the conda or mamba command, load either a miniconda3 or miniforge module and then run the source command
shared among all users if the environment is installed in a shared directory
private to one user if the environment is installed in a user's private directory
The command 'conda info' shows important configurations for conda environment.
Below are some important configurations:
envs directories
: a list of directories where a conda environment is installed by default. In the output of 'conda info' above, the first default directory to install a conda environment is a $HOME/anaconda.
package cache
: a list of directories where downloaded packages are stored.
To create a new conda environment in a default directory, run the following command:
To create a new conda environment in a different directory, run the following command:
After creating a conda environment, users can activate a conda environment to install or access packages in the environment via the following command.
If you need to activate a conda environment in a bash script, you need to source the conda.sh as shown in the following example bash script:
module load miniconda3/23.11.0s
source /oscar/runtime/software/external/miniconda3/23.11.0/etc/profile.d/conda.sh
conda activate my_env
Do NOT activate a conda environment before submitting a batch job if the batch job activates a conda environment. Otherwise, the batch job will not be able to activate the conda environment and hence fail.
To deactivate a conda environment, simply use the following command:
To install a package, we need to first activate a conda environment, and then run
conda install package_name=version
The "=version" is optional. By default, conda install a package from the anaconda channel. To install a package from a different channel, run conda install
with the -c
option. For example, to install a package from the bioconda channel, run
conda install -c bioconda package_name
To delete a conda environment, run
Conda may download lots of additional packages when installing a package. A user may use up all quota due to these downloaded packages. To remove the downloaded packges, run
The appropriate anaconda module has been loaded (if you are unsure about this one, consult )