2019-04-25 13:44:51 +00:00
|
|
|
# enable conda and activate the notebook environment
|
2022-01-28 14:58:13 +00:00
|
|
|
eval $(micromamba shell hook -s posix -p ${CONDA_DIR})
|
|
|
|
for name in conda mamba; do
|
|
|
|
CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/${name}.sh"
|
|
|
|
test -f $CONDA_PROFILE && . $CONDA_PROFILE
|
|
|
|
done
|
2019-04-25 13:44:51 +00:00
|
|
|
if [[ "${KERNEL_PYTHON_PREFIX}" != "${NB_PYTHON_PREFIX}" ]]; then
|
|
|
|
# if the kernel is a separate env, stack them
|
2019-05-24 09:25:56 +00:00
|
|
|
# so both are on PATH, notebook first
|
2022-01-28 14:58:13 +00:00
|
|
|
mamba activate ${KERNEL_PYTHON_PREFIX}
|
|
|
|
mamba activate --stack ${NB_PYTHON_PREFIX}
|
2019-05-24 09:25:56 +00:00
|
|
|
|
|
|
|
# even though it's second on $PATH
|
|
|
|
# make sure CONDA_DEFAULT_ENV is the *kernel* env
|
|
|
|
# so that `!conda install PKG` installs in the kernel env
|
|
|
|
# where user packages are installed, not the notebook env
|
|
|
|
# which only contains UI when the two are different
|
|
|
|
export CONDA_DEFAULT_ENV="${KERNEL_PYTHON_PREFIX}"
|
2019-04-25 13:44:51 +00:00
|
|
|
else
|
2022-01-28 14:58:13 +00:00
|
|
|
mamba activate ${NB_PYTHON_PREFIX}
|
2019-04-25 13:44:51 +00:00
|
|
|
fi
|