Build locally

Local development environment

Clone the repo

Start by cloning the repo:

git clone https://github.com/mamba-org/mamba.git

Then move to the newly created directory:

cd mamba

Install dev requirements

Make sure you have Mamba’s development requirements installed in your environment.
To do so, you can use your existing mamba or micromamba installation:
mamba env update --name <env_name> --file environment-dev.yml
micromamba install --name <env_name> --file environment-dev.yml

If you don’t have one, refer to the installation page.

mamba relies on python setup.py installation while others targets rely on cmake configuration.

Note

All cmake commands listed below use bash multi-line syntax. On Windows, replace \ trailing character with ^.

Build mamba

If you build mamba in a different environment than base, you must also install conda in that environment:

mamba install conda -c conda-forge

For a local (dev) build, run in the environment:

pip install -e .

This will build and install mamba in the current environment.

Build micromamba

Dynamically linked

To build micromamba, just activate the BUILD_EXE flag in cmake command:

mkdir -p build
cd build
cmake .. \
    -BUILD_EXE=ON
cmake --build . -j

Note

Feel free to use your favorite generator: make, ninja, etc.

Note

If you need to install, use to install in your current development environment:

  • -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX [unix]

  • -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX\\Library [win]

Doing so, you have built the dynamically linked version of micromamba.
It’s well fitted for development but is not the artifact shipped when installing micromamba.

Statically linked

micromamba is a fully statically linked executable. To build it, you need to install extra requirements:

micromamba install --name <env_name> --file environment-static-dev.yml

It will install the development version of dependencies, including static libraries.

Now you can run cmake with the additional flag STATIC_DEPENDENCIES turned on:

mkdir -p build
cd build
cmake .. \
    -DBUILD_EXE=ON \
    -DSTATIC_DEPENDENCIES=ON
cmake --build . -j

Tests

You should now be able to run the Python-based test suite:

pytest ./test/micromamba

Build libmamba

Shared library

You need to enable the build of libmamba shared library using BUILD_SHARED flag in cmake command:

mkdir -p build
cd build
cmake .. \
    -DBUILD_SHARED=ON
cmake --build . -j

Static library

The static build of libmamba is enabled by default (BUILD_STATIC=ON).
You can run :
mkdir -p build
cd build
cmake ..
cmake --build . -j

Tests

First, compile the gtest-based C++ test suite:

mkdir -p build
cd build
cmake .. \
    -DENABLE_TESTS=ON
cmake --build . -j

You should now be able to run:

./test/test_mamba

Alternatively you can use:

make test

Note

The static version of libmamba is necessary to build the C++ tests, don’t disable it!