LinuxCommandLibrary

mamba

Manage conda environments and packages

TLDR

Create a new environment, installing the specified packages into it

$ mamba create [[-n|--name]] [environment_name] [python=3.10 matplotlib]
copy

Install packages into the current environment, specifying the package channel
$ mamba install [[-c|--channel]] [conda-forge] [python=3.6 numpy]
copy

Update all packages in the current environment
$ mamba update --all
copy

Search for a specific package across repositories
$ mamba repoquery search [numpy]
copy

List all environments
$ mamba info --envs
copy

Remove unused [p]ackages and [t]arballs from the cache
$ mamba clean -pt
copy

Activate an environment
$ mamba activate [environment_name]
copy

List all installed packages in the currently activated environment
$ mamba list
copy

SYNOPSIS

mamba [options] <command> [arguments]

Common commands:
mamba install [options] <package_name> [<package_name> ...]
mamba create [options] -n <environment_name> [<package_name> ...]
mamba update [options] <package_name> [<package_name> ...]
mamba remove [options] <package_name> [<package_name> ...]
mamba env list
mamba clean [options]

PARAMETERS

-h, --help
    Show the help message and exit.

-y, --yes
    Do not ask for confirmation before proceeding.

-n <env_name>, --name <env_name>
    Name of the environment to create or operate on.

-p <path>, --prefix <path>
    Full path to the environment prefix.

-c <channel_url>, --channel <channel_url>
    Additional channel to search for packages. Can be used multiple times.

--override-channels
    Ignore existing channel names and use only those provided with --channel.

--strict-channel-priority
    Enforce strict channel priority during dependency resolution.

--no-deps
    Do not install dependencies. Only install specified packages.

--file <path>
    Read package specifications from a given file (e.g., environment.yml).

--update-all
    Update all packages in the current environment to the latest versions (used with 'mamba update').

--force-reinstall
    Force reinstall all specified packages, even if they are already installed (used with 'mamba install').

DESCRIPTION

Mamba is a modern, fast, and robust cross-platform package manager that serves as a re-implementation of the popular conda package manager. Built with C++ and leveraging libsolv for dependency resolution, Mamba significantly outperforms conda in terms of speed, especially when dealing with complex environments or large numbers of packages. Its key innovations include parallel package downloads and a highly optimized dependency solver, making environment creation and package installation remarkably quicker.

Mamba maintains full compatibility with existing conda packages, channels, and commands, allowing users to seamlessly switch from conda by simply replacing conda with mamba in most operations. It is widely adopted in scientific computing, data science, and machine learning communities where managing complex software environments and dependencies is crucial.

CAVEATS

Mamba is not a standard pre-installed Linux command-line utility. It requires separate installation, typically within a Conda or Miniconda environment. While highly compatible with Conda, subtle differences in behavior or error messages might occur. Its primary utility is for managing Python, R, and other scientific software environments, not general system-level package management.

INSTALLATION

Mamba is typically installed via

conda install -c conda-forge mamba

or as part of the

Mambaforge

distribution, which provides a minimalist Conda-like installer with Mamba pre-bundled. It's important to install Mamba within a Conda-managed environment.

MICROMAMBA

Micromamba is a tiny, self-contained, and single-file version of Mamba, designed for lightweight and portable use cases, often in Docker containers or CI/CD pipelines. It offers similar functionality to Mamba but with a smaller footprint and easier distribution.

HISTORY

Mamba originated as a faster, more robust reimplementation of the Conda package manager, primarily developed by the Quansight/QuantStack teams. It was created to address performance bottlenecks and dependency resolution challenges inherent in Conda, especially for large and complex scientific computing environments. Development focused on leveraging C++ for core operations and integrating 'libsolv' (a highly optimized dependency solver used by projects like DNF and Zypper) to achieve significant speed improvements. Mamba was first released in 2019 and quickly gained traction as a preferred tool for managing Conda environments due to its superior performance.

SEE ALSO

conda(1), pip(1), micromamba(1), apt(8), dnf(8)

Copied to clipboard