ha9u63a7
ha9u63a7

Reputation: 6862

Conda vs. Mamba Confusion - What should be used when building custom docker images

I am trying to build a custom Docker Image using jupyter/datascience-notebook which is based off of jupyter/base-notebook

I can see that mamba was used to install/configure conda environment for jupyter.

Below is my Dockerfile (the portion which the question is about)

#REF: https://stackoverflow.com/q/66547389

RUN /opt/conda/bin/conda create -n pypy pypy ipykernel -y
RUN /opt/conda/envs/pypy/bin/pypy -m ipykernel install --prefix=/opt/conda/ --name pypy3 --display-name="pypy3"

#-- INSTALL JUPYTERLAB PLUGINS --#
RUN /opt/conda/bin/conda install -c conda-forge jupyterlab-git
RUN /opt/conda/bin/conda install -c conda-forge jupyter-resource-usage

My question - should I actually be using mamba instead of /opt/conda/bin/conda since Mamba is a wrapper on conda? Or, am I doing the right thing?

Regards,

Upvotes: 6

Views: 13267

Answers (1)

Will Holtz
Will Holtz

Reputation: 958

In terms of functionality, either conda or mamba should work. I'd generally choose mamba over conda as mamba is faster than conda, but some may prefer conda as it is a more mature project.

conda is implemented in python, and therefore is not the fastest implementation possible. mamba is not a wrapper on conda, but a partial re-implementation that is focused on performance. mamba is written in C++, does parallel downloading of repository data and package files using multi-threading, and utilizes libsolv for much faster dependency solving. mamba utilities some of the conda code base for tasks that are not critical to performance and therefore mamba has a dependency on python.

Another option is micromamba, which is a purely C++ re-implementation of conda and does not have a dependency on python. If you are creating a new image from scratch and you do not need python in your image, then you should use micromamba to keep your resulting image small. The image mambaorg/micromamba is a good starting point (full disclosure, I am the lead maintainer of this image).

As of March 16, 2022, it is possible to use mamba's solver from within conda.

Upvotes: 15

Related Questions