Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mamba 2 for the base installation of Miniforge #715

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
12 changes: 6 additions & 6 deletions Miniforge3/construct.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% set version = os.environ.get("MINIFORGE_VERSION", "24.11.3-0") %}
{% set conda_libmamba_solver_version = "24.9.0"%}
# when mamba_version is updated here, also update MICROMAMBA_VERSION in scripts/build.sh
# As of Dec 2024 -- mamba 2.0.5 isn't compatible with constructor
# https://github.com/conda-forge/miniforge/issues/697
{% set mamba_version = "1.5.12" %}
{% set version = os.environ.get("MINIFORGE_VERSION", "24.11.3-1") %}
{% set conda_libmamba_solver_version = "25.1.0"%}
jjerphan marked this conversation as resolved.
Show resolved Hide resolved
# When `mamba_version` is updated here, also update the value of:
# - `MICROMAMBA_VERSION` in `scripts/build.sh`
# - `MAMBA_VERSION` in `scripts/test.sh`
{% set mamba_version = "2.0.5" %}

name: Miniforge3
version: {{ version }}
Expand Down
3 changes: 2 additions & 1 deletion build_miniforge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ for TEST_IMAGE_NAME in ${TEST_IMAGE_NAMES}; do
echo "============= Test installer on ${TEST_IMAGE_NAME} ============="
docker run --rm \
-v "$(pwd):${CONSTRUCT_ROOT}" -e CONSTRUCT_ROOT \
--platform "linux/${DOCKER_ARCH}" "${DOCKER_ARCH/\//}/${TEST_IMAGE_NAME}" /construct/scripts/test.sh
-v /etc/ssl/certs:/etc/ssl/certs:ro \
Copy link
Member Author

@jjerphan jjerphan Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side-note: I am not sure about the source of CA certificates libmamba 1 uses, but libmamba 2 uses the system's CA certificates by default now, so the trust store storing them now needs to be mounted.

Are there other scripts or docker image usage in miniforge or conda-forge for which the trust store will need to be mounted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other scripts or docker image usage in miniforge or conda-forge for which the trust store will need to be mounted?

No, everything depends on openssl package from conda-forge which uses ca-certificates package in conda-forge. So, libmamba=2 behaviour is wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so this might explain issues like mamba-org/mamba#3570.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once downloaded, micromamba should just work "offline" no internet or certificates required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mamba-org/mamba#3765 aims at resolving it.

--platform "linux/${DOCKER_ARCH}" "${DOCKER_ARCH/\//}/${TEST_IMAGE_NAME}" /construct/scripts/test.sh
done
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo "***** Install constructor *****"
mamba install --yes \
--channel conda-forge --override-channels \
jinja2 curl libarchive \
"constructor>=3.9.3"
"constructor>=3.11.1"

if [[ "$(uname)" == "Darwin" ]]; then
mamba install --yes \
Expand All @@ -38,7 +38,7 @@ cp LICENSE "${TEMP_DIR}/"
ls -al "${TEMP_DIR}"

if [[ "${TARGET_PLATFORM}" != win-* ]]; then
MICROMAMBA_VERSION=1.5.11
MICROMAMBA_VERSION=2.0.5
MICROMAMBA_BUILD=0
mkdir "${TEMP_DIR}/micromamba"
pushd "${TEMP_DIR}/micromamba"
Expand Down
64 changes: 64 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -ex
echo "***** Start: Testing Miniforge installer *****"

export CONDA_PATH="${HOME}/miniforge"
export MAMBA_VERSION="${MAMBA_VERSION:-2.0.5}"

CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-${PWD}}"

Expand Down Expand Up @@ -72,6 +73,28 @@ EOF
conda list
fi

echo "+ Mamba does not warn (check that there is no warning on stderr)"
mamba --help 2> stderr.log
test ! -s stderr.log
rm -f stderr.log

echo "+ mamba info"
mamba info

echo "+ mamba config sources"
mamba config sources

echo "+ mamba config list"
mamba config list

echo "+ Testing mamba version (i.e. ${MAMBA_VERSION})"
mamba info --json | python -c "import sys, json; info = json.loads(sys.stdin.read()); assert info['mamba version'] == '${MAMBA_VERSION}', info"
echo " OK"

echo "+ Testing mamba channels"
mamba info --json | python -c "import sys, json; info = json.loads(sys.stdin.read()); assert any('conda-forge' in c for c in info['channels']), info"
echo " OK"

echo "***** Python path *****"
python -c "import sys; print(sys.executable)"
python -c "import sys; assert 'miniforge' in sys.executable"
Expand All @@ -84,3 +107,44 @@ python -c "import platform; print(platform.machine())"
python -c "import platform; print(platform.release())"

echo "***** Done: Testing installer *****"

echo "***** Testing the usage of mamba main commands *****"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: are there other commands or behaviors one could test?


echo "***** Initialize the current session for mamba *****"
export MAMBA_ROOT_PREFIX="/root/miniforge"
eval "$(mamba shell hook --shell bash)"
Comment on lines +113 to +115
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: MAMBA_ROOT_PREFIX and the shell hook will be set in the shell profile file by the installation script if users choose to have it run during the installation, which is not the case here.

I would also like to test when this is the case if possible.


echo "***** Create a new environment *****"
ENV_PREFIX="/tmp/testenv"

mamba create -p $ENV_PREFIX numpy --yes -vvv

echo "***** Activate the environment with mamba *****"
mamba activate $ENV_PREFIX

echo "***** Check that numpy is installed with mamba list *****"
mamba list | grep numpy

echo "***** Deactivate the environment *****"
mamba deactivate

echo "***** Activate the environment with conda *****"
conda activate $ENV_PREFIX

echo "***** Check that numpy is installed with python *****"
python -c "import numpy; print(numpy.__version__)"

echo "***** Remove numpy *****"
mamba remove numpy --yes

echo "***** Check that numpy is not installed with mamba list *****"
mamba list | grep -v numpy

echo "***** Deactivate the environment with conda *****"
conda deactivate

echo "***** Remove the environment *****"
mamba env remove -p $ENV_PREFIX --yes

echo "***** Done: Testing mamba main commands *****"

Loading