{renv}: renv::restore()... not installing several packages -- why?

I think I happen to know the answer to this.

First - the problem with class is probably to do with the R version you are using on Posit.Cloud. I just happened to come across this SO post today. The lockfile you linked to is for R4.1 - and Posit.Cloud is giving you 4.3.

The other thing worth noting about that lock file is that it seems to be malformed - there should be a URL associated with the repository.

There is hope though. If you just want to get the project running you could try renv::init()and follow the 'Discard the lockfile and re-initialize" option. This will essentially just start from scratch, with newer versions of the packages. I usually find this works. See this section of the renv docs.

To your other questions:

  1. Not sure what's going on there. Sorry.
  2. When renv failed to install class, it just stopped. So everything listed in the lock file below class (that's not a dependency of a package above class) was not installed. You'll notice that the first package starts with 'd' because renv more-or-less goes down the list alphabetically.
  3. This is part of diagnostics, but not really helpful for the problem with class.

FWIW - the problem with renv not playing nicely with different versions of R is an easy trap to fall into. Unlike other environment managers (like conda or venv for python), renv only deals with the packages and doesn't create a virtual environment for the version of R. Most of the time this doesn't matter - R doesn't make wild changes in the way Python sometimes does. But it does mean that sometimes renv just breaks.

2 Likes