[R] R_LIBS var needed to be set after upgrade to R 4.2.2

Jeroen Ooms
Wed, 01 Jun 2022 12:05:51 -0000

On Wed, Jun 1, 2022 at 11:02 AM Ashim Kapoor <ashimkapoor at gmail.com>
wrote:
>
> My confusion is : Earlier R --vanilla incantation was working fine,
> even without my intervening and
> adding to R_LIBS. That is why I was confused.
>
> My main query is : Is there anything special to R 4.2.0 which needs
> R_LIBS to be setup seperately?

I was hit by this problem as well a few weeks ago. You may get a more
detailed answer in r-sig-debian or from Dirk directly, but from what I
understood, this is now expected behavior: indeed if you start R
--vanilla then /usr/local/lib is no longer included in the library
path.

The reason is that R-core made a change in 4.2.0 to pre-set values for
R_LIBS_USER and R_LIBS_SITE in Renviron [1] which would take
precedence over the proper distro defaults (that include
/usr/local/lib) as configured by the r-base deb/rpm packages. To
mitigate the problem the the r-base deb package moved the appropriate
R_LIBS_USER and R_LIBS_SITE definitions into Renviron.site, which
takes precedence over Renviron. However a side effect of this solution
is that Renviron.site is ignored in --vanilla mode. At least this is
my best understanding of the problem.

[1] https://cran.r-project.org/doc/manuals/r-release/NEWS.html