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).
- To download
mambaforge, follow these instructions (also listed below):Download mamba-forge
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
Activate mamba-forge (to override a previous installation, just add
-u)bash Mambaforge-Linux-x86_64.sh
- Accept the license
- 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. - At the end of installation, type
yesto initialize mamba-forge. - 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)
To enable the necessary configuration for your environment and activate the `base` environment,
source ~/.bashrc
- Use mamba commands to create & activate environments, and install packages.
Use
mamba create
for creating new environments. For example,mamba create -n test numpy
will create a new environment calledtestand install numpy into it.Once created, you can activate this new environment using
mamba activate test
and then install new packages usingmamba install
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 packagespytorchandtorchvisionfrom thepytorchchannel.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 runpip install <PACKAGE>
- For more details on how to use mamba, check out the conda tutorial.