Skip to content

Commit

Permalink
Use micromamba 2.0.0rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
Hind-M committed Aug 23, 2024
1 parent 125ee3a commit 8840c10
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion repo2docker/buildpacks/conda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_build_env(self):
("MAMBA_ROOT_PREFIX", "${CONDA_DIR}"),
# this exe should be used for installs after bootstrap with micromamba
# switch this to /usr/local/bin/micromamba to use it for all installs
("MAMBA_EXE", "${CONDA_DIR}/bin/mamba"),
("MAMBA_EXE", "/usr/local/bin/micromamba"),
("CONDA_PLATFORM", self._conda_platform()),
]
if self._nb_requirements_file:
Expand Down
10 changes: 5 additions & 5 deletions repo2docker/buildpacks/conda/activate-conda.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# enable conda and activate the notebook environment
eval $(micromamba shell hook -s posix -p ${CONDA_DIR})
for name in conda mamba; do
eval $(micromamba shell hook -s posix -r ${CONDA_DIR})
for name in conda; do
CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/${name}.sh"
test -f $CONDA_PROFILE && . $CONDA_PROFILE
done
if [[ "${KERNEL_PYTHON_PREFIX}" != "${NB_PYTHON_PREFIX}" ]]; then
# if the kernel is a separate env, stack them
# so both are on PATH, notebook first
mamba activate ${KERNEL_PYTHON_PREFIX}
mamba activate --stack ${NB_PYTHON_PREFIX}
micromamba activate ${KERNEL_PYTHON_PREFIX}
micromamba activate --stack ${NB_PYTHON_PREFIX}

# even though it's second on $PATH
# make sure CONDA_DEFAULT_ENV is the *kernel* env
Expand All @@ -17,5 +17,5 @@ if [[ "${KERNEL_PYTHON_PREFIX}" != "${NB_PYTHON_PREFIX}" ]]; then
# which only contains UI when the two are different
export CONDA_DEFAULT_ENV="${KERNEL_PYTHON_PREFIX}"
else
mamba activate ${NB_PYTHON_PREFIX}
micromamba activate ${NB_PYTHON_PREFIX}
fi
15 changes: 11 additions & 4 deletions repo2docker/buildpacks/conda/install-base-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -ex

cd $(dirname $0)

export MAMBA_VERSION=1.5.8
export CONDA_VERSION=24.5.0
export MAMBA_VERSION=2.0.0rc2
export CONDA_VERSION=24.7.0

URL="https://anaconda.org/conda-forge/micromamba/${MAMBA_VERSION}/download/${CONDA_PLATFORM}/micromamba-${MAMBA_VERSION}-0.tar.bz2"

Expand All @@ -21,7 +21,7 @@ time wget -qO- ${URL} | tar -xvj bin/micromamba
mv bin/micromamba "$MICROMAMBA_EXE"
chmod 0755 "$MICROMAMBA_EXE"

eval "$(${MICROMAMBA_EXE} shell hook -p ${CONDA_DIR} -s posix)"
eval "$(${MICROMAMBA_EXE} shell hook -r ${CONDA_DIR} -s posix)"

micromamba activate

Expand All @@ -36,7 +36,14 @@ update_dependencies: false
# channel_priority: flexible
EOT

micromamba install conda=${CONDA_VERSION} mamba=${MAMBA_VERSION} -y
# TODO: remove channels and conda-libmamba-solver once 2.0.0 is used.
micromamba install \
-c conda-canary/label/conda-libmamba-solver-pr-457 \
-c conda-forge/label/mamba_dev \
-c conda-forge \
"conda-canary/label/conda-libmamba-solver-pr-457::conda-libmamba-solver>=${CONDA_VERSION}" \
"conda>=${CONDA_VERSION}" \
mamba=${MAMBA_VERSION} -y

echo "installing notebook env:"
cat "${NB_ENVIRONMENT_FILE}"
Expand Down
18 changes: 9 additions & 9 deletions tests/conda/py35-binder-dir/verify
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ out = sh([kernel_python, "--version"], stderr=STDOUT)
v = out.split()[1]
assert v[:3] == "3.5", out

out = sh(["micromamba", "--version"])
assert out == "1.5.8", out

out = sh(["mamba", "--version"])
assert (
out
== """mamba 1.5.8
conda 24.5.0"""
), out
#out = sh(["micromamba", "--version"])
#assert out == "1.5.8", out

#out = sh(["mamba", "--version"])
#assert (
# out
# == """mamba 1.5.8
#conda 24.5.0"""
#), out

sh([kernel_python, "-c", "import numpy"])
2 changes: 1 addition & 1 deletion tests/conda/py36-postBuild/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -ex

# mamba/conda installs in kernel env
mamba install -y make
micromamba install -y make

# note `pip` on path is _not_ the kernel env!
# is this what we (or users) want?
Expand Down

0 comments on commit 8840c10

Please sign in to comment.