Skip to content

Commit

Permalink
Merge pull request #223 from nmfs-opensci/eeholmes-patch-1
Browse files Browse the repository at this point in the history
only init conda if not RSTUDIO terminal
  • Loading branch information
eeholmes authored Feb 19, 2025
2 parents da7dcb5 + 5bce9d2 commit dabe9d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion base-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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..." \
Expand Down
13 changes: 7 additions & 6 deletions scripts/install-rocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dabe9d4

Please sign in to comment.