Search code examples
rtidyverselibrariestibble

Why I get Warning in install.packages : cannot remove prior installation of package ‘tibble’Permission restored ‘tibble’?


I have tried to load the library(tidyverse). However, I got an error like:

Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace ‘tibble’ 2.1.3 is already loaded, but >= 3.0.0 is required

I have followed what everyone is suggesting:

remove.package("tibble") 
install.packages("tibble")

However, I get this error:

Warning in install.packages :
  cannot remove prior installation of package ‘tibble’
Warning in install.packages :
  problem copying D:\Rlibraries\00LOCK\tibble\libs\x64\tibble.dll to D:\Rlibraries\tibble\libs\x64\tibble.dll: Permission denied
Warning in install.packages :
  restored ‘tibble’

I see a problem in the path - "D:\Rlibraries\00LOCK\tibble\..."

I check my .libPaths() as others suggested on stackoverflow. I get this:

[1] "D:/Rlibraries"                      "C:/Program Files/R/R-3.6.3/library"

I believe the issue lies in the path - "D:/Rlibraries/00LOCK" because my defaulted library is "D:/Rlibraries".

Does someone know why this is occuring and how to solve this mistery? I never had this issue before.


Solution

  • I also encountered this situation when a package installation went wrong.

    This problem occured to others, and there's even a function against this in the pacman Package Management package :

    Sometimes install.packages can "fail so badly that the lock directory is not removed: this inhibits any further installs to the library directory (or for –pkglock, of the package) until the lock directory is removed manually." p_unlock deletes the directory 00LOCK that is left behind.

    You can also do it manually : stop all R / RStudio sessions, find the 00LOCK directory (which might disappear as you close RStudio), and delete it.

    This post explains how to avoid the lock.