diff --git a/repo2docker/buildpacks/r.py b/repo2docker/buildpacks/r.py index ddc18ed3..4c77e591 100644 --- a/repo2docker/buildpacks/r.py +++ b/repo2docker/buildpacks/r.py @@ -350,11 +350,11 @@ def get_build_scripts(self): ), ( "${NB_USER}", - # Install a pinned version of devtools, IRKernel and shiny + # Install a pinned version of remotes, 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 --no-save --no-restore --no-init-file --no-environ --quiet -e "install.packages(c('remotes', 'devtools', 'IRkernel', 'shiny'), repos=Sys.getenv(\"EXPANDED_CRAN_MIRROR_URL\"))" && \ + R --no-save --no-restore --no-init-file --no-environ --quiet -e "IRkernel::installspec(prefix=Sys.getenv(\"NB_PYTHON_PREFIX\"))" """, ), ] @@ -390,7 +390,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 --no-save --no-restore --no-init-file --no-environ {installR_path} && touch /tmp/.preassembled || true && rm -rf /tmp/downloaded_packages", ) ] @@ -408,14 +408,17 @@ 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 --no-save --no-restore --no-init-file --no-environ {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 --no-save --no-restore --no-init-file --no-environ --quiet -e "remotes::install_local()"', + ) ] return assemble_scripts