package load fails, already loaded, newer version is required

When executing library(here), I get the message

Error: package or namespace load failed for ‘here’ in

loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rprojroot’ 1.3-2 is already loaded, but >= 2.0.2 is required

I have version 2.02 of rprojroot installed (I can see this under the packages tab). I have restarted R many times. When I start R and run

sessionInfo()
I can see that rprojroot 1.3-2 is "loaded via a namespace (and not attached):

Running version 3.6.3 of R on Windows 10 x64.

How do I fix this? Seems like I need to control the packages loaded via a namespace.

Thanks

Can you try updating rprojroot again?
Can you detach rprojroot and then reload?
Can you delete rprojroot and reinstall it?
https://github.com/r-lib/rprojroot

I'm being tortured by R. This isn't just related to rprojroot (or here). It's more pervasive and seems to be a namespace problem. If I can use the unloadNamespace() function, I can get things working. Just now I tried to load a package called RedTor. It generates "Error: package or namespace load failed for ‘RedTor’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.9 is required"
I try

unloadNamespace("rlang") and get "Error in unloadNamespace("rlang") :
namespace ‘rlang’ is imported by ‘ellipsis’, ‘testthat’, ‘pkgload’, ‘pillar’, ‘lifecycle’, ‘htmltools’, ‘usethis’ so cannot be unloaded"

So I need to unload those, but those may in turn generate other messages.

It seems that this is related to what gets loaded in R. I run sessionInfo() and note what is loaded via a namespace (and not attached) - about 41 packages. Wish I knew how to keep these from loading. Any help appreciated. I have no .rdata being loaded as far as I can tell and no packages loading in .renviron.

When I have bad problems installing and loading packages, I usually reinstall R from scratch.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.