Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Feb 3, 2025
1 parent 07625ea commit 551bcb7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 38 deletions.
21 changes: 16 additions & 5 deletions repo2docker/buildpacks/conda/activate-conda.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# enable conda and activate the notebook environment
set -ex

CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/conda.sh"
echo "Activating profile: ${CONDA_PROFILE}"
test -f $CONDA_PROFILE && . $CONDA_PROFILE

eval $(micromamba shell hook -s posix -r ${CONDA_DIR})
for name in conda mamba; do
CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/${name}.sh"
echo "Activating profile: ${CONDA_PROFILE}"
test -f $CONDA_PROFILE && . $CONDA_PROFILE
done

export MAMBA_ROOT_PREFIX="${CONDA_DIR}"
__mamba_setup="$("${CONDA_DIR}/bin/mamba" shell hook --shell posix 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
alias mamba="${CONDA_DIR}/bin/mamba" # Fallback on help from mamba activate
fi
unset __mamba_setup

if [[ "${KERNEL_PYTHON_PREFIX}" != "${NB_PYTHON_PREFIX}" ]]; then
# if the kernel is a separate env, stack them
# so both are on PATH, notebook first
Expand All @@ -21,3 +31,4 @@ if [[ "${KERNEL_PYTHON_PREFIX}" != "${NB_PYTHON_PREFIX}" ]]; then
else
mamba activate ${NB_PYTHON_PREFIX}
fi

6 changes: 0 additions & 6 deletions repo2docker/buildpacks/conda/install-base-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# and sets up the base environment
set -ex

DIRECTORY=$(dirname $0)
echo "PWD: `pwd`"
echo "DIRECTORY: $DIRECTORY"

cd $(dirname $0)

export MAMBA_VERSION="2.0.6.rc2"
Expand All @@ -28,8 +24,6 @@ chmod 0755 "$MICROMAMBA_EXE"
# Setting up micromamba in this shell and permanently
eval "$(${MICROMAMBA_EXE} shell hook --root-prefix ${CONDA_DIR} -s posix)"

cp ${DIRECTORY}/mamba.sh ${CONDA_DIR}/etc/profile.d/mamba.sh

micromamba activate

export PATH="${PWD}/bin:$PATH"
Expand Down
27 changes: 0 additions & 27 deletions repo2docker/buildpacks/conda/mamba.sh

This file was deleted.

0 comments on commit 551bcb7

Please sign in to comment.