Old package version persists after reinstalling

Until last night RStudio allowed me to build packages. Now, when I try to update documentation, I get an error:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'cli' 2.0.1 is being loaded, but >= 2.0.2 is required
Calls: suppressPackageStartupMessages ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted

Exited with status 1.

However, the installed version of cli is 2.0.2.

First I uninstalled cli, devtools and roxygen2 and installed them in the order cli, roxygen2 and devtools When that didn't solve the problem I uninstalled R, RStudio and all libraries, then reinstalled them, but still the problem persists.

There is only one library location (.libPaths() gives "C:/Program Files/R/R-3.6.3/library"), and there is only one version of cli and devtools in the directory. The cli DESCRIPTION says "Version: 2.0.2"

Please, how can I solve the problem? I want to build packages.

Thank you


I think I stumbled upon a fix; Switching off the option, "Use devtools package if available" in "Build tools" allows documentation and package creation.

So problem seems centred on devtools. I'll try reloading again, when I have time, and see if that solves things permanently.

Thank you,


1 Like

If you're on Windows, I recommend installing R packages in a personal library, (e.g. C:/Users/username/Documents/R/win-library/3.6). My guess is that your issue might be in part due to permissions. For example, if you open R or RStudio with "Run as administrator", it will allow you to install/update packages in the system library C:/Program Files/R/R-3.6.3/library. But if you go back and open R/RStudio as a regular user, you'll no longer be able to update those packages.

Thank you @jdblischak

My environmental variable R_LIBS_USER contains only my personal library path, not the C:/Program Files/R/R-3.6.3/library.

However, I am still getting duplicate copies of libraries opening, and causing a ruckus (e.g., there are 2 lattice packages open, one is renamed "lattice.1", which is an older version, and my code seems to be pulling functions from that package and throwing an error. update.packages() does not fix it).

In RStudio (v 1.3.959-1), .libPaths() returns both my personal library and the default library path mentioned above.

How do I remove the default library path? Using Windows 10.

I don't think that is what you want to do. The default library contains the base R package (named base) as well as other critical packages like stats and graphics. In other words, you wouldn't be able to use R.

Something strange happened with your packages. To help us advise you on how to fix the situation, could you please run the following in the R console and report the results?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.