From bcb46e140e3f122883c2306b8f2b1d7aa11c816b Mon Sep 17 00:00:00 2001 From: Raniere Gaia Costa da Silva Date: Wed, 9 Jul 2025 17:12:54 +0200 Subject: [PATCH 1/2] Add --vanilla to R call Closes https://github.com/jupyterhub/repo2docker/issues/1431 --- repo2docker/buildpacks/r.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repo2docker/buildpacks/r.py b/repo2docker/buildpacks/r.py index 93148a94..1611460e 100644 --- a/repo2docker/buildpacks/r.py +++ b/repo2docker/buildpacks/r.py @@ -358,8 +358,8 @@ def get_build_scripts(self): # Install a pinned version of devtools, IRKernel and shiny rf""" export EXPANDED_CRAN_MIRROR_URL="$(. /etc/os-release && echo {cran_mirror_url} | envsubst)" && \ - R --quiet -e "install.packages(c('devtools', 'IRkernel', 'shiny'), repos=Sys.getenv(\"EXPANDED_CRAN_MIRROR_URL\"))" && \ - R --quiet -e "IRkernel::installspec(prefix=Sys.getenv(\"NB_PYTHON_PREFIX\"))" + R --vanilla --quiet -e "install.packages(c('devtools', 'IRkernel', 'shiny'), repos=Sys.getenv(\"EXPANDED_CRAN_MIRROR_URL\"))" && \ + R --vanilla --quiet -e "IRkernel::installspec(prefix=Sys.getenv(\"NB_PYTHON_PREFIX\"))" """, ), ] @@ -395,7 +395,7 @@ def get_preassemble_scripts(self): "${NB_USER}", # Delete /tmp/downloaded_packages only if install.R fails, as the second # invocation of install.R might be able to reuse them - f"Rscript {installR_path} && touch /tmp/.preassembled || true && rm -rf /tmp/downloaded_packages", + f"Rscript --vanilla {installR_path} && touch /tmp/.preassembled || true && rm -rf /tmp/downloaded_packages", ) ] @@ -413,14 +413,14 @@ def get_assemble_scripts(self): "${NB_USER}", # only run install.R if the pre-assembly failed # Delete any downloaded packages in /tmp, as they aren't reused by R - f"""if [ ! -f /tmp/.preassembled ]; then Rscript {installR_path}; rm -rf /tmp/downloaded_packages; fi""", + f"""if [ ! -f /tmp/.preassembled ]; then Rscript --vanilla {installR_path}; rm -rf /tmp/downloaded_packages; fi""", ) ] description_R = "DESCRIPTION" if not self.binder_dir and os.path.exists(description_R): assemble_scripts += [ - ("${NB_USER}", 'R --quiet -e "devtools::install_local(getwd())"') + ("${NB_USER}", 'R --vanilla --quiet -e "devtools::install_local(getwd())"') ] return assemble_scripts From 356371d7e5207b759d2834a2b31546ab72c5772a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:14:10 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- repo2docker/buildpacks/r.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repo2docker/buildpacks/r.py b/repo2docker/buildpacks/r.py index 1611460e..0c5c6c43 100644 --- a/repo2docker/buildpacks/r.py +++ b/repo2docker/buildpacks/r.py @@ -420,7 +420,10 @@ def get_assemble_scripts(self): description_R = "DESCRIPTION" if not self.binder_dir and os.path.exists(description_R): assemble_scripts += [ - ("${NB_USER}", 'R --vanilla --quiet -e "devtools::install_local(getwd())"') + ( + "${NB_USER}", + 'R --vanilla --quiet -e "devtools::install_local(getwd())"', + ) ] return assemble_scripts