You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I open this project with R 4.3.1, renv::status() reports "no issues found". The only indication that I'm not using the correct R version is a message at startup (ℹ Using R 4.3.1 (lockfile was generated with R 4.2.3)) which gets lost among the usual R startup nonsense.
The text was updated successfully, but these errors were encountered:
I came here to report similar issue, I was surprised that there isn't a warning about the R version difference, and that the lockfile will happily just change the version in the lockfile:
> renv::restore()
The version of R recorded in the lockfile will be updated:
- R [4.3.2 -> 4.3.1]
Why not? When you call renv::snapshot(), the version of R that is currently in use is used when updating the lockfile. If you want to 'freeze' the version of R used independently, you can use the r.version project option: https://rstudio.github.io/renv/reference/settings.html#r-version
I agree that adding a warning to renv::status() would be useful, as @eliocamp suggested. We had this need for another project and addressed it by adding some code to .Rprofile (after referencing this stackoverflow post). Hope it's okay to share here for those looking for a temporary fix.
# prints warning if system version of R differs from renv project
r_version <- renv::lockfile_read()$R$Version
if (paste0(version$major, ".", version$minor) != (r_version)) {
warning(paste0("R version ", version$major, ".", version$minor, " is in use. R version ", r_version, " is required."))
}
It took me a couple of instances of going between my two machines. I would snapshot on one, then back up to git, download on the other, then hydrate / restore from the lock file... I would have thought that I would have gotten a notice that I was restoring from a different version of R.
Running
renv::status()
doesn't warn if the R version being used is not the same as the one recorded in the lockfile. Example lockfile:If I open this project with R 4.3.1,
renv::status()
reports "no issues found". The only indication that I'm not using the correct R version is a message at startup (ℹ Using R 4.3.1 (lockfile was generated with R 4.2.3)
) which gets lost among the usual R startup nonsense.The text was updated successfully, but these errors were encountered: