コンテンツへスキップ
LatchkeyLatchkey home

mamba vs conda: より速いcondaのsolver?

mambaはずっと速いC++の依存関係solverを備えたcondaのドロップイン式の代替です。condaはオリジナルで、現在はlibmamba solverも同梱しています。

mambaはcondaコマンドを、並列ダウンロードとより速いSAT solverを用いてC++で再実装し、同じchannelとenvironment.ymlを読みつつ、環境作成を数分から数秒に短縮することがよくあります。最近のcondaバージョンはlibmamba solverを同梱し、差を縮めていますが、mamba(およびmicromamba)は依然としてCI向けにより速く軽量な傾向があります。大半のworkflowでは両者は交換可能です。

mambaconda
Solver高速なC++ (libsolv)classicまたはlibmamba
速度最速libmambaで改善
互換性conda互換リファレンス
フットプリント軽量 (micromamba)重めのベース
最適な用途CI、高速なsolve既存のcondaセットアップ

CIでは

mambaとmicromambaは、遅いcondaのsolveがセットアップ時間を支配するCIで真価を発揮します。micromambaはベース環境を持たない単一の静的バイナリで、使い捨てのrunnerに理想的です。すでにcondaを使っているなら、libmamba solverを有効にすることで、ツールを切り替えずに恩恵の大半を得られます。

高速化

solveがウォームになるよう、environment.ymlをキーにしてpackage cacheをcacheしましょう。どちらもCI runner上で実行されます。より高速なマネージドrunnerは、インストールとsolveのステップをさらに短縮します。

Decide with your own numbers, not a feature table

Feature comparisons age badly and rarely decide anything, because both tools in a mature category can do the job. What differs is how each behaves on your repository, and that takes one afternoon to measure.

Terminal
# time a cold install with each candidate, cache cleared
hyperfine --prepare "rm -rf node_modules" --warmup 1 \
  "<tool-a> install" "<tool-b> install"

# and the thing CI actually pays for: a cold run with no local cache
docker run --rm -v "$(pwd):/w" -w /w node:22 sh -c "<tool> install"

What actually changes when you switch

  • Lockfile format. A switch is a one-way door for anyone still on the old tool until everyone migrates, so plan it as a single coordinated change.
  • Resolution strictness. Tools differ on whether an undeclared transitive import works, and the stricter one will surface latent bugs as new failures.
  • CI cache configuration. The cache path and key differ per tool; carrying over the old ones silently disables caching.
  • Everyone on the team and every runner must move together. Pin the version so they cannot drift.

結論

最速かつ最軽量の環境作成を求める新しいCIセットアップ: micromambaまたはmamba。既存のcondaプロジェクト: libmamba solverを有効にすれば、ツールを変えずに速度の大半を得られます。両者は同じchannelとファイルを読むため、切り替えは低リスクです。

よくある質問

mamba vs conda: A Faster conda Solver?
mamba reimplements conda commands in C++ with parallel downloads and a faster SAT solver, often cutting environment creation from minutes to seconds while reading the same channels and environment.yml.
In CI?
mamba and micromamba shine in CI where slow conda solves dominate setup time; micromamba is a single static binary with no base environment, ideal for ephemeral runners. If you already use conda, enabling the libmamba solver gets much of the benefit without switching tools.
Speed it up?
Cache the package cache keyed on environment.yml so solves are warm. Both run on CI runners; faster managed runners further shorten the install and solve steps.
Which should I choose?
New CI setups wanting the fastest, lightest environment creation: micromamba or mamba. Existing conda projects: enable the libmamba solver to get most of the speed without changing tooling. They read the same channels and files, so switching is low risk.

関連ガイド