5

I'm trying to install rlang package using Rstudio but I'm getting this error:

mv: cannot move '/usr/local/lib/R/site-library/rlang' to '/usr/local/lib/R/site-library/00LOCK-rlang/rlang': Permission denied

Could anyone help please ?

Thanks a lot.

linog
  • 5,786
  • 3
  • 14
  • 28
MOMIL
  • 51
  • 1
  • 2

5 Answers5

5

Sometimes, adding the --no-lock option helps

install.packages("rlang", INSTALL_opts = '--no-lock')

See here for more details

linog
  • 5,786
  • 3
  • 14
  • 28
  • Thanks a lot linog. I'm getting this error when I try you formula: – MOMIL Apr 12 '20 at 15:59
  • Warning in file(file, if (append) "a" else "w") : 2020-04-12 04:36:52 : cannot open file '/usr/local/lib/R/site-library/rlang/DESCRIPTION': Permission denied 2020-04-12 04:36:52 : Error in file(file, if (append) "a" else "w") : 2020-04-12 04:36:52 : cannot open the connection 2020-04-12 04:36:52 : ERROR: installing package DESCRIPTION failed for package ‘rlang’ – MOMIL Apr 12 '20 at 16:00
  • It looks like `R` does not have the (over)writing permission in `usr/local` directory. Maybe the manual procedure proposed by @akrun could be a solution – linog Apr 12 '20 at 16:25
2

I had the same problem. what worked for me, after trying everything else

  1. Detach packages you are trying to update
  2. Physically remove / delete these packages from library
  3. Install packages from R-Studio
Tobias
  • 31
  • 4
0

An option would be to remove the folder with the /00LOCK-rlang/rlang and then reinstall the package

install.packages('rlang')
akrun
  • 874,273
  • 37
  • 540
  • 662
0

Not sure if it is the same problem, but I had a similar issue

ERROR: failed to lock directory ‘[myhome]/R/x86_64-pc-linux-gnu-library/4.2’ for modifying

Try removing ‘[myhome]/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-vctrs’

And I solved it with this pacman function that attempts to delete a 00LOCK(s) if it exists:

install.packages('pacman')
pacman::p_unlock()

It worked for me! Hope it works for you :)

silviaegt
  • 317
  • 3
  • 12
0

I encountered the same issue on my server and I found that this can be solved by changing the default installation path of R package

  • Could you provide more specific detail, and possibly code, to expand upon your answer? – xilliam Jul 19 '22 at 20:49
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 19 '22 at 20:49