Micromamba

Micromamba is a standalone version of Mamba which is an alternative to Conda. This stack delivers a custom anaconda/miniconda type deployment based on the communities conda-forge channel with micromamba as the package manager. For more information visit micromamba documentation

How to Install Micromamba?

SStack tool allows you to install micromamba, and use it to install software in your desired location. For example, to install micromamba named 2022A in your home directory, run:

sstack install -t micromamba -n 2022A

This creates a module file that you can load in your environment to be able to use the micromamba to manage software, as shown in the following:

module use "/home/tahat/sstack/modules"
module load micromamba/2022A

To check if micromamba is now available and you can use it, run the following command:

micromamba --version

Output

0.24.0
micromamba has conflicts with conda, Spack and EasyBuild. This means that you can not load micromamba with any of those stacks at the same time.

How to Use Micromamba to Manage Software?

After loading the appropriate module, you can run install to add new packages to the environment. For example, to install xtensor run:

micromamba install xtensor

Now you can check if the software is available by running:

micromamba list xtensor

Output

List of packages in environment: "/home/tahat/sstack/stacks/micromamba/2022A"

  Name     Version  Build       Channel
─────────────────────────────────────────────
  xtensor  0.24.2   h924138e_0  conda-forge

Create Virtual Environmnet

micromamba allows you to create a new virtual environment. The simplest way you can create a new micromamba environment is like so:

micromamba create -n <env-name>

For example, to create an environment named my_env, run:

micromamba create -n my_env

You can check all available environmnets by running:

micromamba env list

Output

  Name    Active  Path
────────────────────────────────────────────────────────────────────────────
  base    *       /home/tahat/sstack/stacks/micromamba/20222A
  my_env          /home/tahat/sstack/stacks/micromamba/20222A/envs/my_env

The above output shows that my_env is available, and you are currently in base environment.

Create a Module for Virtual Environment

Once you create the environmnet, you can create a module file for it. This will add the environment to the module system where you can load it in your enviroument. A module named base was created when micromamba stack was installed. To see if the base module is available, run:

module avail base

----------------------------------------------------- /home/tahat/sstack/stacks/micromamba/20222A/modules ------------------------------------------------------
   base

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

You need to create module file having the same name of your created environmnet in the same path of base module file (base.lua). To find where to add the module file and what contents you need to add to it, run:

module --raw show base

Output

------------------------------------------------------------------------------------------------------------------------------------------------------------
   /home/tahat/sstack/stacks/micromamba/20222A/modules/base.lua:
------------------------------------------------------------------------------------------------------------------------------------------------------------
help([[For help contact hpc-team@nmsu.edu]])
whatis([[Name : Micromamba Base Env]])
whatis([[Version: Latest]])
whatis([[Target: x86_64]])
whatis([[Short description :  This is a redundant module to load the base micromamba environment as an example.]])

family("mm_env")

-- Modify String In Quotes To Match Desired Environment Name or Path
local env_name = "base"
-- Don't forget to update line 2/3 aswell to update the Module Name/Version

execute{cmd="micromamba activate " .. env_name,modeA={"load"}}
execute{cmd="micromamba deactivate",modeA={"unload"}}

The above output shows that base.lua is in /home/tahat/sstack/stacks/micromamba/20222A/modules. You need to create a module file my_env.lua in the same path, as follows:

touch /home/tahat/sstack/stacks/micromamba/20222A/modules/my_env.lua

Now, you need to copy the content of the base.lua file into my_env.lua.

cp /home/tahat/sstack/stacks/micromamba/20222A/modules/base.lua /home/tahat/sstack/stacks/micromamba/20222A/modules/my_env.lua

Now you need to update my_env.lua to have the correct environment name env_name as commented in line 9 in the file.

vim /home/tahat/sstack/stacks/micromamba/20222A/modules/my_env.lua

Update line 2 and 10, with the correct env-name.

------------------------------------------------------------------------------------------------------------------------------------------------------------
help([[For help contact hpc-team@nmsu.edu]])
whatis([[Name : Micromamba my_env Env]])
whatis([[Version: Latest]])
whatis([[Target: x86_64]])
whatis([[Short description :  This is a redundant module to load the base micromamba environment as an example.]])

family("mm_env")

-- Modify String In Quotes To Match Desired Environment Name or Path
local env_name = "my_env"
-- Don't forget to update line 2/3 aswell to update the Module Name/Version

execute{cmd="micromamba activate " .. env_name,modeA={"load"}}
execute{cmd="micromamba deactivate",modeA={"unload"}}

Check if the created module is available:

module avail my_env

Output

-------------------------------------------------------- /home/tahat/sstack/stacks/micromamba/20222A/modules ---------------------------------------------------------
   my_env

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

For more information visit micromamba documentation