diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py index 837b140bbc..6418d11ebf 100644 --- a/var/spack/repos/builtin/packages/r/package.py +++ b/var/spack/repos/builtin/packages/r/package.py @@ -210,6 +210,11 @@ def setup_dependent_build_environment(self, env, dependent_spec): r_libs_path = ':'.join(r_libs_path) env.set('R_LIBS', r_libs_path) + # R_LIBS_USER gets set to a directory in HOME/R if it is not set, such as + # during package installation with the --vanilla flag. Set it to null + # to ensure that it does not point to a directory that may contain R + # packages. + env.set('R_LIBS_USER', '') env.set('R_MAKEVARS_SITE', join_path(self.etcdir, 'Makeconf.spack'))