Hello, i couldn’t find any related topic or possible solution to my problem and maybe others also running into this issue.
I am trying to give our user’s the oppurtunity to start from inside their own individual conda environments.
But this always fails due to the reason that the conda environment can’t be activated as there appears:
Script starting...
Waiting for Jupyter Notebook server to open port 34311...
TIMING - Starting wait at: Mon Nov 20 17:41:36 CET 2023
++ echo pytorch
pytorch
++ set -x
++ conda --version
conda 4.10.3
++ conda activate pytorch
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
My template conda.sh.erb for the conda enviroments is this one:
#!/usr/bin/env base
set -x
echo "$CONDA_NAME"
<%- if context.sub_type == "conda_env" -%>
set -x
conda --version
#conda init bash
conda activate $CONDA_NAME
<%- end -%>
jupyter () {
"$CONDA_PATH"/jupyter lab --config="${CONFIG_FILE}"
}
export -f jupyter
#conda init bash
#conda activate $CONDA_NAME
relevant parts of form.yml.erb
conda_path:
label: Conda Enviroment
help: |
Select a Conda Enviroment : path to the **/bin folder that includes Jupyterlab**. This is required when using a Conda Submission Environment! Use **pip install jupyterlab** inside your conda enviroment.
cacheable: false
data-filepicker: true
data-show-hidden: true
data-target-file-type: dirs
data-target-file-pattern: 'bin'
readonly: true
conda_name:
widget: "text_field"
label: "Name of your conda Env"
value: "envXY"
help: |
- Name of your custom conda enviroment **required !**
So the path is used to invoke the jupyter-lab from the /bin path of the conda environment and the conda name is used to activate the conda environment.
I have also a classical Jupyterhub running in combination with the batchspawner which is using sudo -E to run the srun command to run the jupyterlab from inside the users conda environment in this setup the activation of the shell is working.
Thanks in advance
Best Regards
Kreefd