mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 06:52:56 +00:00
Use custom conda environment in Jupyter Notebook when user wants to use it (#2050)
* Modify the custom Python kernel - to activate the custom environment - for the respective Jupyter Notebook and Jupyter Console Signed-off-by: Ayaz Salikhov <mathbunnyru@gmail.com> * Add DL3059 to hadolint ignore list Signed-off-by: Ayaz Salikhov <mathbunnyru@gmail.com> * Move hadolint ignore to a single line * Use python heredoc * Remove unused print * Fix style * Do not hardcode CONDA_DIR * Update custom_environment.dockerfile * Use indent=1 * Implement activate_notebook_custom_env.py as a separate script * Do not call Python manually --------- Signed-off-by: Ayaz Salikhov <mathbunnyru@gmail.com> Co-authored-by: Olivier Benz <olivier.benz@b-data.ch>
This commit is contained in:
@@ -28,12 +28,17 @@ RUN "${CONDA_DIR}/envs/${env_name}/bin/python" -m ipykernel install --user --nam
|
||||
RUN "${CONDA_DIR}/envs/${env_name}/bin/pip" install --no-cache-dir \
|
||||
'flake8'
|
||||
|
||||
# Uncomment this section to activate custom environment by default
|
||||
# This changes the custom Python kernel so that the custom environment will
|
||||
# be activated for the respective Jupyter Notebook and Jupyter Console
|
||||
# hadolint ignore=DL3059
|
||||
RUN /opt/setup-scripts/activate_notebook_custom_env.py "{env_name}"
|
||||
|
||||
# Comment the line above and uncomment the section below instead to activate the custom environment by default
|
||||
# Note: uncommenting this section makes "${env_name}" default both for Jupyter Notebook and Terminals
|
||||
# More information here: https://github.com/jupyter/docker-stacks/pull/2047
|
||||
# USER root
|
||||
# RUN \
|
||||
# # This changes a startup hook, which will activate our custom environment for the process
|
||||
# # This changes a startup hook, which will activate the custom environment for the process
|
||||
# echo conda activate "${env_name}" >> /usr/local/bin/before-notebook.d/10activate-conda-env.sh && \
|
||||
# # This makes the custom environment default in Jupyter Terminals for all users which might be created later
|
||||
# echo conda activate "${env_name}" >> /etc/skel/.bashrc && \
|
||||
|
Reference in New Issue
Block a user