Skip to content

Conversation

@michaelmayer2
Copy link

As per discussion in #857 this is a PR to fix the issue.

chmod g+ws "${R_HOME}/site-library"

## Fix library path
echo "R_LIBS=\${R_LIBS-'${R_HOME}/site-library:${R_HOME}/library'}" >>"${R_HOME}/etc/Renviron.site"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I haven't caught up with the discussion, but do we need to remove this instead of changing the order?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also fear (based on mere eyeballing) that the current definition may be quite right. It's not easy to get this right for all cases. I also think R prefers use of R_LIBS_SITE. In Renviron (for the Debian package) I now set

# edd Apr 2003  Allow local install in /usr/local, also add a directory for
#               Debian packaged CRAN packages, and finally the default dir
# edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
# edd Jan 2023  Modify R_LIBS_{USER,SITE} respecting existing values (cf discussion with Kurt Hornik)
R_LIBS_USER=${R_LIBS_USER:-'%U'}
R_LIBS_SITE=${R_LIBS_SITE:-'/usr/local/lib/R/site-library:%S'}

and there also is this in Renviron.site

## # We comment out this line in the default Renviron, you can re-enable it here
## # @R_PLATFORM@ can be eg x86_64-pc-linux-gnu, see /etc/R/Renviron for R_PLATFORM
## # @MAJ_MIN_VERSION@ is likely something like '3.4', see /etc/R/Renviron too
## #
## # Also note that you set this per-user via '%p' and '%v' for platform and version
#R_LIBS_USER=${R_LIBS_USER-'~/R/@R_PLATFORM@-library/@MAJ_MIN_VERSION@'}

as well as this possible interacting with what I have above:

## edd Apr 2003  Allow local install in /usr/local, also add a directory for
##               Debian packaged CRAN packages, and finally the default dir
## edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
## edd Mar 2022  Now in Renviron.site reflecting R_LIBS_SITE
R_LIBS_SITE="/usr/local/lib/R/site-library/:${R_LIBS_SITE}:/usr/lib/R/library"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure where does that leave us with regards to this PR: Do we agree or disagree to remove the R_LIBS definition as proposed by this PR ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my testing using R 4.4.2, changing this line from using R_LIBS to R_LIBS_SITE will also resolve the issue of the user's library path being set last:

echo "R_LIBS_SITE=\${R_LIBS_SITE:-'${R_HOME}/site-library:${R_HOME}/library'}" >> "${R_HOME}/etc/Renviron.site"

After that change, the user's library path will always be set first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants