In R version 4.0.0 library path not writable

Hey all,

I noticed today that my builds failed for only R >= 4.0.0 versions on travis. As we did not changed anything in the travis.yml and it still works for 3.6.3 I assume it might be the setup script.

you can see the failing jobs here:

https://travis-ci.com/github/c-mertes/FRASER/builds/181678791

The error we face is:

Installing Bioconductor
$ Rscript -e 'if (!requireNamespace("BiocManager", quietly=TRUE))  
install.packages("BiocManager");if (TRUE) BiocManager::install(version = "devel", ask = FALSE);cat(append = TRUE, file = "~/.Rprofile.site", "options(repos = BiocManager::repositories());")'
Warning in install.packages("BiocManager") :
  'lib = "/opt/R/4.0.0/lib/R/library"' is not writable
Error in install.packages("BiocManager") : unable to install packages
Execution halted
The command "eval Rscript -e 'if (!requireNamespace("BiocManager", quietly=TRUE))  
install.packages("BiocManager");if (TRUE) BiocManager::install(version = "devel", ask = FALSE);cat(append = TRUE, file = "~/.Rprofile.site", "options(repos = BiocManager::repositories());")' " failed. Retrying, 2 of 3.

Any idea @jeroen and @jimhester what could be the cause and how to fix it?

3 Likes

Did you try to wipe the cache?

yes I did this already. Under the cache option I clicked Delete all repository caches.

We just starting to hit this with R 3.6.3 as well:

https://travis-ci.com/github/bimberlabinternal/OOSAP/jobs/378528732

The command "eval Rscript -e 'if (!requireNamespace("BiocManager", quietly=TRUE)) install.packages("BiocManager");if (FALSE) BiocManager::install(version = "devel", ask = FALSE);cat(append = TRUE, file = "~/.Rprofile.site", "options(repos = BiocManager::repositories());")' " failed. Retrying, 3 of 3.

Warning in install.packages("BiocManager") :
 'lib = "/opt/R/3.6.3/lib/R/library"' is not writable
Error in install.packages("BiocManager") : unable to install packages
Execution halted

1 Like

I am also seeing this on all my new unix builds from R 3.4 to R 4.0. My guess is that since you guys are now using a Debian package to install R it’s probably installing it in a different path than it used to when you were unzipping it directly.

I’m not sure that export is being invoked from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/r.rb#L47 or if the gdebi installation is overwriting these?

Same problem here. The build fails because it can’t write the library path for R >=4.0.

https://travis-ci.org/github/harpomaxx/GSgalgoR/builds/722161711

Any idea for bypassing the problem, at least for now?

Same error. It started to appear around August 27, 2020. Google currently points only to this thread. Looking for advice what to do.
https://travis-ci.com/github/dozmorovlab/preciseTAD/jobs/379115179#L758

Installing Bioconductor
$ Rscript -e 'if (!requireNamespace("BiocManager", quietly=TRUE))  install.packages("BiocManager");if (TRUE) BiocManager::install(version = "devel", ask = FALSE);cat(append = TRUE, file = "~/.Rprofile.site", "options(repos = BiocManager::repositories());")'
Warning in install.packages("BiocManager") :
  'lib = "/opt/R/4.0.0/lib/R/library"' is not writable
Error in install.packages("BiocManager") : unable to install packages
Execution halted

I think @muschellij2 is right that somehow the export is not invoked.
Based on my little test it seems like its only coming up with bioc versions.

https://travis-ci.com/github/c-mertes/test-ci/builds/182026369

So I guess a workaround is to use base R versions and install the bioconductor packages yourself.

It seems that the PATH variable was changed in a recent commit.
I’ve asked Jim @jimhester for more info here https://github.com/travis-ci/travis-build/commit/51f5f85ad56a6cfea94a3ce71d8ced29c26d4e45

We have the same error here:
https://travis-ci.org/github/metabaRfactory/metabaR/builds/723096728

Has anyone found a solution to bypass the problem?

@c-mertes had a good point above - we just switched our config to use base R (require_bioc=False), and installed bioconductor ourselves.

I traced this to the R package installer config options options, specifically the libR.pc file.

pkg-config retrieves information about packages from special metadata files. These files are named after the package, and have a .pc extension.

The previous R install had
rhome=/home/travis/R-bin/lib/R rlibdir=${rhome}/lib rincludedir=/home/travis/R-bin/lib/R/include

the new installer (using gdebi) has
rhome=/opt/R/4.0.0/lib/R rlibdir=${rhome}/lib rincludedir=/opt/R/4.0.0/lib/R/include

1 Like

Thanks! I tried this solution but, as a beginner, I think I didn’t do it right… At which step should we install BiocManager? Could you give a config example?

This is possibly not the most elegant way, and it includes more code than you need, but I think if you add a before_install that runs a script like this (ignore the rest of what’s in this):

and in your script you install the right Bioconductor version, and then update Rprofile (lines 67-77):

That will probably do it.

1 Like

@jeroen @jimhester this PR should resolve the issue by installing packages into per-user location (option 2 below)

A workaround is to install packages manually in the install: phase, passing lib = Sys.getenv("R_LIBS_USER") to install functions everywhere.


https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/install.packages:

lib <…> If missing, defaults to the first element of .libPaths().

https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/libPaths:

The library search path is initialized at startup from the environment variable R_LIBS <…> followed by those in environment variable R_LIBS_USER .

R_LIBS is never set, so the above-mentioned default that the package is configured with must be being used instead.

So we have a few options:

  • install packages system-wide with sudo
  • install packages per-user
  • set R_LIBS (probably not a good idea as there might be something on the default paths already)

I hope this will fix it: https://github.com/travis-ci/travis-build/pull/1957

1 Like

12 posts were split to a new topic: BiocCheck installation cannot install scripts; thus “R CMD BiocCheck” fails

Issue appears solved to me: my Bioconductor builds pass :+1:. Thanks @jeroen and @native-api!

1 Like

OK, thank you for letting us know!

Imprint