MambaForge Python

MambaForge Python

Mambaforge package manager

Description

Mamba (documentation) is a package management tool for Python (compatible to Anaconda, but designed to be faster and with extra features)

Prerequisites

None

Setting up Mamba

This section introduces how to set up mamba (documentation). It was kindly provided by our GPU user Anwai Archit, which is lightly edited to fit the format of this documentation and the first item removed (pointed to instructions to setup conda).

  1. To download mambaforge , follow these instructions (also listed below):
    1. Download mamba-forge

      wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
    2. Activate mamba-forge (to override a previous installation, just add -u )

      bash Mambaforge-Linux-x86_64.sh
    3. Accept the license
    4. Important: Choose your scratch directory for installation, for example: /scratch/usr/<USERNAME>/mambaforge . The space in /home/<USERNAME>  directory is not sufficient for large environments.
    5. At the end of installation, type yes  to initialize mamba-forge.
    6. After following the steps, your conda/mamba installation is available on the cluster (automatically activated when you get a new shell) (if not, see next point)
    7. To enable the necessary configuration for your environment and activate the `base` environment,

      source ~/.bashrc
    8. Use mamba commands to create & activate environments, and install packages.
    9. Use

      mamba create

       
      for creating new environments. For example,

      mamba create -n test numpy


      will create a new environment called test  and install numpy into it.

    10. Once created, you can activate this new environment using

      mamba activate test


      and then install new packages using

      mamba install
    11. If the package you want to install is not available from the default repository, you can add custom repositories (called "channels") by adding -c <CHANNEL_NAME>  to the command. For example,

      mamba install -c pytorch pytorch torchvision


      will install the packages pytorch  and torchvision  from the pytorch channel.

    12. You can also use pip , the most commonly used python package manager, to install packages to the environments (Recommendation - preferrably install packages using mamba). Just activate the correct environment and run

      pip install <PACKAGE>
  2. For more details on how to use mamba, check out the conda tutorial.