Skip to content

Commit 4e89301

Browse files
authored
Merge pull request #1245 from romainx/feat-1210-1
Install mamba in base-notebook
2 parents 67b8fb9 + 82405ab commit 4e89301

File tree

4 files changed

+46
-9
lines changed

4 files changed

+46
-9
lines changed

base-notebook/Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,25 @@ USER root
2626
# Conda version
2727
ARG conda_version="4.9.2"
2828
# Miniforge installer patch version
29-
ARG miniforge_patch_number="5"
29+
ARG miniforge_patch_number="7"
3030
# Miniforge installer architecture
3131
ARG miniforge_arch="x86_64"
32-
# Python implementation to use
33-
# can be either Miniforge3 to use Python or Miniforge-pypy3 to use PyPy
34-
ARG miniforge_python="Miniforge3"
32+
# Package Manager and Python implementation to use (https://github.com/conda-forge/miniforge)
33+
# - conda only: either Miniforge3 to use Python or Miniforge-pypy3 to use PyPy
34+
# - conda + mamba: either Mambaforge to use Python or Mambaforge-pypy3 to use PyPy
35+
ARG miniforge_python="Mambaforge"
3536

3637
# Miniforge archive to install
3738
ARG miniforge_version="${conda_version}-${miniforge_patch_number}"
3839
# Miniforge installer
3940
ARG miniforge_installer="${miniforge_python}-${miniforge_version}-Linux-${miniforge_arch}.sh"
4041
# Miniforge checksum
41-
ARG miniforge_checksum="49dddb3998550e40adc904dae55b0a2aeeb0bd9fc4306869cc4a600ec4b8b47c"
42+
ARG miniforge_checksum="5a827a62d98ba2217796a9dc7673380257ed7c161017565fba8ce785fb21a599"
4243

4344
# Install all OS dependencies for notebook server that starts but lacks all
4445
# features (e.g., download as all possible file formats)
4546
ENV DEBIAN_FRONTEND noninteractive
46-
RUN apt-get update \
47+
RUN apt-get -q update \
4748
&& apt-get install -yq --no-install-recommends \
4849
wget \
4950
ca-certificates \
@@ -102,7 +103,7 @@ RUN mkdir "/home/$NB_USER/work" && \
102103
# Install conda as jovyan and check the sha256 sum provided on the download site
103104
WORKDIR /tmp
104105

105-
# Prerequisites installation: conda, pip, tini
106+
# Prerequisites installation: conda, mamba, pip, tini
106107
RUN wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${miniforge_version}/${miniforge_installer}" && \
107108
echo "${miniforge_checksum} *${miniforge_installer}" | sha256sum --check && \
108109
/bin/bash "${miniforge_installer}" -f -b -p $CONDA_DIR && \
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
4+
import logging
5+
import pytest
6+
7+
LOGGER = logging.getLogger(__name__)
8+
9+
10+
@pytest.mark.parametrize(
11+
"package_manager, cmd",
12+
[
13+
("apt", "--version"),
14+
("conda", "--version"),
15+
("mamba", "--version"),
16+
("npm", "--version"),
17+
("pip", "--version"),
18+
],
19+
)
20+
def test_package_manager(container, package_manager, cmd):
21+
"""Test the notebook start-notebook script"""
22+
LOGGER.info(
23+
f"Test that the package manager {package_manager} is working properly ..."
24+
)
25+
c = container.run(
26+
tty=True, command=["start.sh", "bash", "-c", f"{package_manager} {cmd}"]
27+
)
28+
rv = c.wait(timeout=5)
29+
logs = c.logs(stdout=True).decode("utf-8")
30+
assert (
31+
rv == 0 or rv["StatusCode"] == 0
32+
), f"Package manager {package_manager} not working"
33+
LOGGER.debug(logs)

docs/using/common.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ You can bypass the provided scripts and specify an arbitrary start command. If y
105105

106106
The default Python 3.x [Conda environment](http://conda.pydata.org/docs/using/envs.html) resides in `/opt/conda`. The `/opt/conda/bin` directory is part of the default `jovyan` user's `$PATH`. That directory is also whitelisted for use in `sudo` commands by the `start.sh` script.
107107

108-
The `jovyan` user has full read/write access to the `/opt/conda` directory. You can use either `conda` or `pip` to install new packages without any additional permissions.
108+
The `jovyan` user has full read/write access to the `/opt/conda` directory. You can use either `conda`, `mamba` or `pip` to install new packages without any additional permissions.
109109

110110
```bash
111111
# install a package into the default (python 3.x) environment
112112
pip install some-package
113113
conda install some-package
114+
mamba install some-package
114115
```
115116

116117
### Using alternative channels

docs/using/selecting.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ and versioning strategy.
2828
[options common across all core stacks](common.md). It is the basis for all other stacks.
2929

3030
- Minimally-functional Jupyter Notebook server (e.g., no LaTeX support for saving notebooks as PDFs)
31-
- [Miniforge](https://github.com/conda-forge/miniforge) Python 3.x in `/opt/conda`
31+
- [Miniforge](https://github.com/conda-forge/miniforge) Python 3.x in `/opt/conda` with two package managers
32+
- [conda](https://github.com/conda/conda): "cross-platform, language-agnostic binary package manager".
33+
- [mamba](https://github.com/mamba-org/mamba): "reimplementation of the conda package manager in C++".
3234
- No preinstalled scientific computing packages
3335
- Unprivileged user `jovyan` (`uid=1000`, configurable, see options) in group `users` (`gid=100`)
3436
with ownership over the `/home/jovyan` and `/opt/conda` paths

0 commit comments

Comments
 (0)