[R] /usr/local/lib/R/site-library is not writable

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Apr 8 00:34:25 CEST 2021

Hi Gene,
This is probably not best practice, but I install packages as root,
which allows me to write into the default library. The restriction on
non-root users being blocked from making changes to appications is
pretty standard.


On Thu, Apr 8, 2021 at 8:18 AM Gene Leynes <gleynes using gmail.com> wrote:
> Hello R Community,
> I've been using R for a long time, and this is a question that still makes
> me think twice every single time I install R, which is more and more often .
> The first search hit is this StackOverflow question:
> https://stackoverflow.com/questions/32540919/library-is-not-writable
> The warning message hasn't changed over the years:
> install.packages("randomForest")
> Installing package into ‘/usr/local/lib/R/site-library’
> (as ‘lib’ is unspecified)
> Warning in install.packages :
>   'lib = "/usr/local/lib/R/site-library"' is not writable
> In this question they suggest using the personal library, which is what I
> end up doing as well, but some people suggest changing your group.  This
> actually seems like the right answer to me, but others say they had
> problems when they changed groups, which also sounds about right.
> Can someone please tell me (or tell StackOverflow) the real best practice?
> I've gotten into some very thorny issues with installations that can't find
> any library when I deploy jobs using cron or other users, and it's hard to
> remember / figure out how to install (if missing) libraries in the script
> because it's hard to remember the mirror syntax.
> I know there's a packrat  package, and I've invented some workarounds, but
> I normally just need two or three stable packages for a particular project.
> I'd bet that .libPaths would be implemented differently today, but maybe
> with the right library path none of that would be necessary to understand?
> My final simplified questions are:
>    1. What is the best practice to install libraries so that the current
>    user (Linux) can always find them?
>    2. Why is the default library path not writable by default, should we
>    change that?
> Hope everyone's doing well out there, and I hope to see some of you at
> conferences when things get back to normal.
> Thank you,
> Gene
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list