'lib = "/usr/lib/R/library"' is not writable" while installing R Bioconductor package

SirOsric picture SirOsric · Oct 29, 2015 · Viewed 7.6k times · Source

everyone! I'm trying to install Bioconductor package "cummeRbund" and constantly fail. I've tried biocLite("cummeRbund") command with BiocInstaller enabled, install.packages("cummeRbund") and their variations with specified library address. The result is always

"Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  'lib = "/usr/lib/R/library"' is not writable"

and r keeps offering me to use personal directory. What should I do to get rid of this pesky issue ("cummeRbund" is not the only one package that keeps failing to install)?

My specs.: Ubuntu 14.04 LTS 64-bit, R version 3.2.2 (2015-08-14) -- "Fire Safety", Bioconductor version 3.2 (BiocInstaller 1.20.0)

Answer

Konrad Rudolph picture Konrad Rudolph · Oct 29, 2015

It’s not uncommon that R’s default library path is unwriteable for the current user. This usually means that R was installed by a different user. This isn’t a problem in itself. Just configure R to use a different library path.

To do this, set the R_LIBS_USER environment variable. To preserve it across shell sessions, set the value in ~/.profile or similar.

export R_LIBS_USER=/path/to/your/r-library

There’s a detailed description of this solution in another answer.

Another solution is to install software for each user separately. This especially makes sense on a non-shared system. Most package managers support installing software for the local user, without super user rights. In particular, Homebrew does that by default, and strongly recommends against using sudo to install software.