Micromamba Usage Guide

Table of Contents

Overview

Micromamba is package manager most often used for installing Python packages.   It is a more compact version of the Mamba package manager. Micromamba supports most of the essential commands of mamba and conda.  As of 01/27/25 miniconda is no longer available on Nova. Please load and use micromamba instead.

Setup

Micromamba is a free minimal installer for conda and mamba packages. On ISU clusters micromamba is available via an environment module. To begin, start an interactive session on a compute node with the salloc command and then load micromamba:

salloc -n 4 -N 1 --mem=8GB --time=2:00:00  # Replace with your desired options.

module load micromamba

Note: You can see all available versions of micromamba on ISU HPC clusters with:

module spider micromamba

Creating an Environment

First we need to create an environment.  By default micromamba tries to use your /home directory as it's base.  This is less than ideal however as micromamba packages can take up a lot of disk space and quickly overfill a users quota.  To get around this we use the --prefix option when creating our environment.  

micromamba create --prefix /PATH/TO/MY/ENV # where /PATH/TO/MY/ENV is replaced with your path.  

Next we need to hook our shell before we can activate our environment.

eval "$(micromamba shell hook --shell=bash)"

And then we activate our environment.

micromamba activate /PATH/TO/MY/ENV # where again /PATH/TO/MY/ENV is replaced with the path used previously.

Installing Packages

Modifying the cache location

By default micromamba uses your home directory for its package cache.  These can also easily overfill a users home directory quota.  To avoid this you should set your pkgs directory somewhere with a large storage quota.

micromamba config append pkgs_dirs /PATH/TO/MY/CACHE/LOCATION

You can verify changes are in effect by issuing

micromamba config list

Changes using micromamba config are stored in ~/.condarc by default.  

Adding Channels

Micromamba calls package repositories channels.  You'll need to add some channels to download and install packages.  We are going to add two channels: conda-forge which is micromamba's default repository and bioconda which is a repository for specialized software for bioinformatics.    

micromamba config append channels conda-forge

micromamba config append channels bioconda

micromamba config set channel_priority strict

You can verify changes are in effect y issuing

micromamba config list

Package Installation

Now we are ready to install packages.  Installation of packages is as easy as

micromamba install MYPACKAGE 

Replacing MYPACKAGE above with your desired module.  

You can view which packages are installed in your environment with micromamba list

Packages can be searched using micromamba repoquery search MYPACKAGE

Package Removal

Packages can be removed by issuing:

micromamba remove MYPACKAGE

Deactivating an Environment

Deactivating a micromamba environment is as easy as

micromamba deactivate

Removing Environments

Micromamba environments can be removed with

micromamba env remove -p /PATH/TO/MY/ENV

Cleaning Cache

Micromamba will only clean it's cache when explicitly told to do so.  This can take up a lot of storage space after awhile.  To clean the cache use

micromamba clean --all

Listing All Environments

All micromamba environments can be listed using the following command:

micromamba env list

Configuration Files

Micromamba stores it's configurations by default in .condarc.  However, it also read configurations from .mambarc.  Micromamba uses the following precedence when reading configuration files:

// on_unix
{
"/etc/conda/.condarc",
"/etc/conda/condarc",
"/etc/conda/condarc.d/",
"/etc/conda/.mambarc",
"/var/lib/conda/.condarc",
"/var/lib/conda/condarc",
"/var/lib/conda/condarc.d/",
"/var/lib/conda/.mambarc"
}
// on_win
{
"C:\\ProgramData\\conda\\.condarc",
"C:\\ProgramData\\conda\\condarc",
"C:\\ProgramData\\conda\\condarc.d",
"C:\\ProgramData\\conda\\.mambarc"
}

{ root_prefix }/.condarc
{ root_prefix }/condarc
{ root_prefix }/condarc.d
{ root_prefix }/.mambarc
~/.conda/.condarc
~/.conda/condarc
~/.conda/condarc.d
~/.condarc
~/.mambarc
{ target_prefix }/.condarc
{ target_prefix }/condarc
{ target_prefix }/condarc.d
{ target_prefix }/.mambarc
$CONDARC,
$MAMBARC;

Best Practices

  • Always use a compute node when installing packages with Micromamba.  Micromamba can still be computationally intensive and cause issues for other users with it's used on a login node.
  • Use storage with Large Quotas.  See Modifying the cache location for instructions on how to avoid this.