Mamba

ID

mamba

Home page

https://mamba.readthedocs.io

Version requirement

>= 2

Platforms

🐧 Linux · 🍎 macOS · 🪟 Windows

Operations

installed · outdated · search · install · upgrade · upgrade_all · remove · cleanup

purl types

pkg:mamba

CLI name

mamba

Issues and PRs

📦 manager: conda-based

Source

meta_package_manager/managers/mamba.py

Conda-compatible package manager, reimplemented in C++.

Reaches the same channels conda does, resolving with libsolv behind a command line of its own rather than delegating to conda. It is wrapped on the same grounds as nala over apt: same archives, separate implementation. Since 2.0 it shares no code with conda at all, the Python executable of the 1.x line having been replaced by a dynamically linked build of micromamba.

Important

Every operation targets mamba’s currently active environment, which is base when none is activated. mpm neither activates nor switches environments: it inspects and mutates whatever mamba resolves from the inherited CONDA_PREFIX / CONDA_DEFAULT_ENV, exactly as a bare mamba call in the same shell would, and exactly as the conda wrapper does. Per-environment targeting is not supported yet.

Caution

Sharing that prefix with conda is why the two are serialized against each other. mamba takes a real lock on the environment and on every package cache directory for the length of a transaction, and conda honors none of them: its own locking covers the repodata cache alone. Running them at once corrupts rather than blocks, which upstream has closed as not planned (conda/conda#13037).

Note

No sync. Nothing in the command set refreshes the index on its own, the closest being clean --index-cache, which only forces a refetch on the next operation. The conda wrapper implements none either, so this is parity rather than a gap.

Warning

mamba upgrade does not exist: unlike conda, mamba never aliased it, and calling it exits non-zero on an unexpected argument. Upgrades go through update.

Documentation: mamba user guide.

What mpm adds to mamba

Through mpm, mamba gains --extended search, to match against package descriptions.

Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover mamba alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.

Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.

Your mamba commands, in mpm

You already know mamba: each operation maps one-to-one onto mpm, in an interface shared by every manager.

To…

With mamba

With mpm

List what’s installed

mamba list --json

mpm --mamba installed

List outdated packages

mamba update --all --dry-run --json

mpm --mamba outdated

Search for a package

mamba search "*zstd*" --json

mpm --mamba search <pkg>

Install a package

mamba install --yes zstd

mpm install pkg:mamba/zstd

Upgrade one package

mamba update --yes zstd

mpm --mamba upgrade zstd

Upgrade everything

mamba update --all --yes

mpm --mamba upgrade --all

Remove a package

mamba remove --yes zstd

mpm remove pkg:mamba/zstd

Clear caches

mamba clean --all --yes

mpm --mamba cleanup --cache

Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.

Operations

Operation

Supported

Notes

installed

outdated

orphans

search

extended search backfilled by mpm

install

upgrade

upgrade_all

remove

sync

cleanup

doctor

Selecting and configuring mamba

Deselect mamba for a single run with --no-mamba, or persist the choice in your configuration:

[mpm]
mamba = false

Keep it enabled but tune how mpm drives it with a per-manager override:

[mpm.managers.mamba]
timeout = 900

mpm config-template mamba prints every overridable attribute as a ready-to-paste block.

Recipes

A few jobs you would otherwise script around mamba, one mpm command each:

  • Snapshot and clone a machine: mpm --mamba dump mamba.toml, then mpm restore mamba.toml on the next one.

  • Export a compliance SBOM: mpm --mamba sbom (CycloneDX by default, --spdx for SPDX).

Privilege escalation

mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.

See privilege escalation for the full policy.

Concurrency

mpm never runs mamba at the same time as conda or micromamba: they act on one environment prefix and one package cache, and conda honors none of the locks mamba takes on them. Each mutating operation waits for the previous one, even with a higher --jobs, while managers outside this group keep running in parallel.

Only mutations are held back. The read-only queries (installed, outdated, search) take no backend lock and stay fully concurrent.

Cooldown

State of Mamba’s release-age gating, from the cooldown support table:

  • Status: 🚧 Proposed (library API merged, no CLI flag)

  • Mechanism: exclude_newer_timestamp, libmambapy only

  • Reference: mamba-org/mamba#4254

A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:

  • Registry: anaconda.org / conda-forge (pkg:conda)

  • Retraction: Relabel: “we do not allow edits or the deletion of packages on conda-forge” (immutability); a bad artifact is labelled broken and “Users will no longer be able to install them by default” (procedure)

  • Publish date: ✅ upload_time, with the broken label carried in labels (API)

With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.

Version probe

The version is probed by running:

$ mamba --version
2.9.0

and extracted with:

r"^(?P<version>\d+\.\d+\.\d+\S*)$"

Reference traces

Raw native outputs captured in the manager source: the reference mpm’s parsers were written against. If you know Mamba well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ mamba list --json
{
    "log_history": [],
    "packages": [
        {
            "base_url": "https://conda.anaconda.org/conda-forge",
            "build_number": 2,
            "build_string": "h23cfdf5_2",
            "channel": "conda-forge",
            "dist_name": "libiconv-1.18-h23cfdf5_2",
            "md5": "4d5a7445f0b25b6a3ddbb56e790f5251",
            "name": "libiconv",
            "platform": "osx-arm64",
            "url": "https://conda.anaconda.org/conda-forge/osx-arm64/libiconv-1.18-h23cfdf5_2.conda",
            "version": "1.18"
        }
    ]
}
$ mamba update --all --dry-run --json
{
    "actions": {
        "LINK": [
            {
                "build": "h23cfdf5_2",
                "fn": "libiconv-1.18-h23cfdf5_2.conda",
                "name": "libiconv",
                "version": "1.18"
            }
        ],
        "PREFIX": "/opt/conda",
        "UNLINK": [
            {
                "build": "h23cfdf5_1",
                "fn": "libiconv-1.17-h23cfdf5_1.conda",
                "name": "libiconv",
                "version": "1.17"
            }
        ]
    },
    "dry_run": true,
    "log_history": [],
    "prefix": "/opt/conda",
    "success": true
}
$ mamba update --all --dry-run --json
{
    "dry_run": true,
    "log_history": [],
    "message": "All requested packages already installed",
    "prefix": "/opt/conda",
    "success": true
}

Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --mamba installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.

Changelog

  • 7.7.0.dev0 (unreleased)

    • Implement mamba and micromamba, the C++ reimplementation of conda and its statically linked twin. Both read the inventory from list --json, accepting the array both bare and inside the envelope 2.9.0 introduced, and synthesize outdated from the dry-run transaction the way the conda wrapper does. Search matches package names exactly without falling back to mpm’s own refiltering.

    • Stop running conda, mamba and micromamba concurrently. They act on one environment prefix and one package cache, and conda honors none of the locks mamba takes on them.