Installing Conda packages more quickly using Mamba¶
The ITSR support team often receive tickets from Conda users concerned that creating environments and installing packages is taking quite a long time. Now we have moved to Miniforge exclusively for all Conda usage on Apocrita, the Mamba libsolver is available for all package installs.
What is Mamba?¶
Anaconda traditionally used conda
as its package manager, but over time it
became quite slow at resolving dependencies when installing packages.
mamba
is a re-implementation of conda
written in C++ offering the following
benefits:
- parallel downloading of repository data and package files using multi-threading
libsolv
for much faster dependency solving, a state of the art library used in the RPM package manager of Red Hat, Fedora and OpenSUSE- core parts of
mamba
are implemented in C++ for maximum efficiency
At the same time, mamba
utilises the same command line parser, package
installation code and transaction verification routines as conda
to stay as
compatible as possible.
Why Mamba?¶
Put simply, in a lot of cases mamba
is a lot faster at installing packages
when compared to conda
:
Installing packages with Mamba¶
Do not use a login node for creating Conda environments
Creating a Conda environment requires a reasonably large amount of time and
memory. Do not use a login node for creating a Conda environment. Please use
an
interactive qlogin
session.
Environment creation is single-core, so 1 core for 1 hour with 8GB RAM is recommended for following the example below:
qlogin -l h_vmem=8G -l h_rt=1:0:0
A popular package with Apocrita users is busco.
Using mamba
instead of conda
, busco
takes less than five minutes to
install.
So, to use mamba
to install busco
:
1) Load the miniforge
module:
module load miniforge
2) Create a new Conda env (I've called mine busco
but it can be called
anything you like):
mamba create --quiet --yes --name busco
3) Activate the environment:
mamba activate busco
4) Install busco
(version 5.8.2) using mamba
:
mamba install bioconda::busco=5.8.2
mamba
will now rapidly pull all required dependencies and ask you to confirm
the package installation list (which you can do by typing y
and pressing
Enter
). The installation should then complete within just a few minutes, and
busco
will be available in your env:
(busco) $ busco -v
BUSCO 5.8.2
(busco) $ busco -h
usage: busco -i [SEQUENCE_FILE] -l [LINEAGE] -o [OUTPUT_NAME] -m [MODE] [OTHER OPTIONS]
...
Conclusion¶
You can find more information about mamba
on the project's
official docs page, as well as on the
QMUL Miniforge
docs page.
We hope you find these tips useful. As usual, you can ask a question on our Slack channel (QMUL users only), or by sending an email to its-research-support@qmul.ac.uk which is handled directly by staff with relevant expertise.
Title image: Generated using Stable Diffusion
Comparison video: Taken from the
Anaconda Blog