Today I had top spent up some hours to set up direnv for ‘microsamba’.
Since due to the reduced installation there are no acticate
scripts to source and I had troubles to set up the correct layout.
For instance
layout_micromamba() {
export MAMBA_HOME="${HOME}/Data/micromamba"
export MAMBA_EXE="${HOME}/.local/bin/micromamba"
export MAMBA_ROOT_PREFIX='/home/abu/Data/micromamba'
local my_shell=$(basename ${SHELL})
local env_name="$1"
__mamba_setup="$("${MAMBA_EXE}" shell hook --shell "${my_shell}" --root-prefix "${MAMBA_ROOT_PREFIX}" 2> /dev/null)"
__mamba_activate="$("${MAMBA_EXE}" activate "${env_name}")"
eval " ${__mamba_setup}"
if [ -n "$1" ]; then
# Explicit environment name from layout command.
eval activate ${env_name}
elif (grep -q name: environment.yml); then
# Detect environment name from `environment.yml` file in `.envrc` directory
eval "$mamba_hook; micromamba activate $(grep name: environment.yml | sed -e 's/name: //')"
else
(>&2 echo No environment specified);
exit 1;
fi;
unset __mamba_setup
unset __mamba_activate
}
puts an output error
direnv: loading ~/test-env/.envrc
action: hool not in {init,deinit,reinit,hook,activate,deactivate,reactivate}
Run with --help for more information.
'micromamba' is running as a subprocess and can't modify the parent shell.
Thus you must initialize your shell before using activate and deactivate.
To initialize the current bash shell, run:
$ eval "$(micromamba shell hook --shell=bash)"
and then activate or deactivate with:
$ micromamba activate
To automatically initialize all future (bash) shells, run:
$ micromamba shell init --shell=bash --prefix=~/micromamba
Supported shells are {bash, zsh, csh, xonsh, cmd.exe, powershell, fish}.
critical libmamba Shell not initialized
direnv: export ~PATH
I tried several methods but none worked out.