From fa008600c80ded3de595ac2be7a38db93b319056 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 19 Feb 2025 08:12:32 -0800 Subject: [PATCH 1/2] only init conda if not RSTUDIO terminal --- base-image/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base-image/Dockerfile b/base-image/Dockerfile index 309bd32..ff37d81 100644 --- a/base-image/Dockerfile +++ b/base-image/Dockerfile @@ -50,7 +50,10 @@ RUN echo "Creating ${NB_USER} user..." \ # Note this is only read by shell, but not by the jupyter notebook - that relies # on us starting the correct `python` process, which we do by adding the notebook conda environment's # bin to PATH earlier ($NB_PYTHON_PREFIX/bin) -RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh ; conda activate ${CONDA_ENV}" > /etc/profile.d/init_conda.sh +RUN echo 'if [[ ! -v RSTUDIO || ! -v R_HOME ]]; then \ + . ${CONDA_DIR}/etc/profile.d/conda.sh; \ + conda activate ${CONDA_ENV}; \ +fi' > /etc/profile.d/init_conda.sh # Install basic apt packages RUN echo "Installing Apt-get packages..." \ From 5bce9d2335528b56824fc6cbd1812e14056bd3bd Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 19 Feb 2025 08:24:37 -0800 Subject: [PATCH 2/2] make sure PATH is set correctly for login bash --- scripts/install-rocker.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/install-rocker.sh b/scripts/install-rocker.sh index cc1fbfa..2b61dda 100644 --- a/scripts/install-rocker.sh +++ b/scripts/install-rocker.sh @@ -101,12 +101,13 @@ if command -v tlmgr &> /dev/null; then tlmgr install pdfcol tcolorbox eurosym upquote adjustbox titling enumitem ulem soul rsfs fi -# Set the terminal in RStudio to have the clean PATH wo conda so don't use .bashrc which is for JLab -#if test -f /etc/rstudio/rserver.profile; then -# echo 'export PATH="$PATH"' > /home/jovyan/.rstudio-bashrc -# chown jovyan:jovyan /home/jovyan/.rstudio-bashrc -# echo "BASH_ENV=/home/jovyan/.rstudio-bashrc" >> /etc/rstudio/rserver-profile -#fi +# Make sure that the default terminal opened in RStudio (which is a login bash) sets the PATH +current_path="$PATH" +echo 'if [[ ! -v RSTUDIO || ! -v R_HOME ]]; then \ + # Set PATH to the captured current_path value \ + export PATH="'$current_path'"; \ + echo "Setting PATH to captured value: '$current_path'"; \ +fi' > /etc/profile.d/rstudio_set_path.sh sudo chown -R jovyan:jovyan /etc/rstudio sudo chmod -R u+rwX /etc/rstudio