Open FlorianPargent opened 6 months ago
Ok I found a solution, but I do not know whether this is the most elegant one:
renv::install("openssl")
.renv::record("openssl@2.20")
renv::restore()
again and repeat steps 1 and 2 for all packages that also cannot be installed (which were several in my case)renv::update()
to update all packages that are required by the project to the most current version. Then I would use renv::snapshot()
to update the lockfile.What would be much more convenient would be an option that would run renv::update()
but not for the packages that are already installed in my project but for all the packages that are recorded in the initial lockfile. Does something like this exist?
I did not find an option in renv::update()
where I can provide a lockfile, there is only the packages
argument.
One hack that should work is running renv::update(packages = renv::lockfile_read()$Packages |> names())
.
I cannot believe this functionality is not already available somewhere in renv...
I think I was wrong and renv::update(packages = renv::lockfile_read()$Packages |> names())
does not work for packages that are not already installed...
Maybe one could use renv::install(packages = renv::lockfile_read()$Packages |> names())
instead.
Hey Florian, didn't notice you had opened this issue until Malika pointed it out to me yesterday.
In short, I encountered this same problem as you with restoring the library after I updated to R version 4.4.0, and likewise had to tediously install new package versions and record()
them in the lockfile. I don't know if there's an explicit fix here, or if there are just cross-version compatibility problems with openssl and R. (Note: I also encounter similar issues somewhat frequently with the MASS and Matrix packages being used with different R versions.)
Some of the Library Management functions might be of use? But I can't be sure without really isolating the problem.
@FlorianPargent so I installed rig to play around with restoring {renv} libraries from different versions of R because I've also been constantly running into these installation/restore issues since upgrading to R4.4. Here's what I did:
library(MASS)
library(Matrix)
library(plotly)
At least on my Mac, it seems there's an incompatibility issue with GCC between some of the more recent R versions? In any case, this is something I'll also note in the tutorial and I'll probably make a separate tutorial about using rig.
(Less rigorously, I started a renv project at R4.3.3 and tried to upgrade/downgrade R versions before restoring. Also encountered package installation failures this way.)
Ironically, I ran into a problem with restoring the packages from the lockfile from this very repo and I think finding a solution how to solve this might be relevant for the tutorial itself.
Problem description: When I
renv::restore()
, the process aborts because the openssl package cannot be installed. I do not understand why (perhaps because I am on R version 4.4.0).Failed solutions: I tried installing the newest version of openssl manually with
renv::install("openssl")
which works. But now, I cannot find any solution how to restore() without installing openssl in the old version again. I have tried usingrenv::restore(exclude = "openssl")
which does not work because openssl is a dependency of several packages. I have tried excluding all packages for which the lockfile lists openssl as a dependency:renv::restore(exclude = c("credentials", "gert", "httr", "httr2", "openssl"))
However for reasons that I do not understand, this will still try to install openssl and fails. I have also tried to setoptions(renv.config.install.transactional = FALSE)
, because I thought this would allow the restore to keep going even if some packages cannot be installed, but this also does not work.Do you know how to solve my problem?