R install.packages returns "failed to create lock directory" R install.packages returns "failed to create lock directory" r r

R install.packages returns "failed to create lock directory"


On NFS file systems it is sometimes not obvious what things you have to close.

The best way to avoid this is to use the --no-lock argument on the command line, i.e.:

R CMD INSTALL --no-lock <pkg>

From within R, you can do this from within your command using:

install.packages("Rcpp", dependencies = TRUE, INSTALL_opts = '--no-lock')


This happens when your last package installation has interrupted abnormally. to fix this you should remove the locked file. For example Execute this command in R console:

unlink("/home/me/src/Rlibs/00LOCK-Rcpp", recursive = TRUE)

Hope this helps!


The easiest way to avoid this issue is before installing any package run the line below

options("install.lock"=FALSE)

Then try the install.packages("name_of_package") to install the package. The 00LOCK error would not come.