Linux | conda | Make package/environment creation much faster
How to speed up the micromamba install process (both installing micromamba itself and, more importantly, creating environments + installing packages with it).
1. Install micromamba as quickly as possible
The fastest ways to get micromamba on your system:
Recommended (one-liner, works on Linux/macOS/Git Bash on Windows):
This is the official quickest method.1
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)macOS with Homebrew (very fast if you already have brew):
1
brew install micromambaManual download (fastest for scripts/CI, no shell init needed initially):
1
2
3
4# Linux x86_64 example
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
./bin/micromamba shell init -s bash -r ~/micromamba # or your preferred prefix
source ~/.bashrc
After installation, run micromamba self-update to get the latest version (newer releases often include solver and download improvements).
Set a custom root prefix early if you want (e.g., on a fast SSD or large disk): 1
export MAMBA_ROOT_PREFIX=~/micromamba # or /fast/ssd/micromamba
2. Make package/environment creation much faster
Micromamba (and mamba) is already dramatically faster than classic conda thanks to its C++ solver (libsolv) and parallel operations. Here are the key optimizations:
Use only
conda-forge(biggest single speedup):Mixing channels (especially defaults + conda-forge) slows down the solver a lot.1
2
3micromamba config append channels conda-forge
micromamba config append channels nodefaults # disable defaults channel
micromamba config set channel_priority strictCreate environments from a YAML file (instead of many separate
installcommands):Or inline:1
micromamba create -n myenv -f environment.yml -y1
micromamba create -n myenv python=3.12 numpy pandas -c conda-forge -yEnable parallel downloads and fast settings: Micromamba already uses multi-threading for downloads and solving by default. You can tune it with these config options (add to
~/.condarcor~/.mambarc):1
2
3
4
5
6# In ~/.condarc
solver: libmamba # usually default
channel_priority: strict
# Optional performance tweaks:
# fetch_threads: 0 # 0 = auto (uses all cores; try higher/lower if network is bottleneck)
# repodata_threads: 0 # auto for repodata fetching- Leverage the shared package cache: Micromamba caches downloaded packages and repodata (channel indexes) in
$MAMBA_ROOT_PREFIX/pkgs/.- First install is slower (downloads everything).
- Subsequent installs are much faster because it reuses hard links from the cache.
Keep the sameMAMBA_ROOT_PREFIXacross projects for maximum reuse.
- First install is slower (downloads everything).
Offline / pre-download mode (great for repeated setups or air-gapped machines):
1
2
3
4
5# On a machine with internet
micromamba create -n myenv --download-only -f environment.yml
# Then copy the pkgs cache or use --offline on target machine
micromamba create -n myenv --offline -f environment.yml- Other practical tips:
- Avoid running installs while already inside an activated environment (can cause repeated activation overhead in some cases).
- For CI/Docker: Use the official
mambaorg/micromambaDocker image or thesetup-micromambaGitHub Action — it installs in ~1 second. - On slow networks: The bottleneck is often downloading repodata/packages. Use a local mirror or proxy if possible (advanced).
- Clean up occasionally:
micromamba clean --all -yto free space (but keep cache for speed).