Open zkamvar opened 3 years ago
Another potentially separate issue, but errors might appear at first when trying to hydrate, but resolve themselves later as packages get installed via restore: https://codimd.carpentries.org/_4KFOwW-R0eYgwkhu6SIdg?view
Another data point:
https://github.com/zkamvar/test-with-renv/runs/3861848594?check_suite_focus=true
# https://carpentries.r-universe.dev =
- stringi [*/*@HEAD: dfc45538 -> 7248caee]
* Querying repositories for available binary packages ... Done!
* Querying repositories for available source packages ... Done!
Error : failed to retrieve package 'stringi'
I've added {stringi} to The Carpentries r-universe, but here's the problem:
{renv} expects all versions of a package to be retrievable from repository archives based on the version number. This unfortunately breaks when you have a package taken from an R-Universe. Why you ask? It's because R-universe is not an archive. When stringi updated from 1.7.4.9000 to 1.7.5, the devel version was lost and renv got confused.
Luckily, there may be a solution to this by setting the renv.retrieve.repos.archive.path
option: https://github.com/rstudio/renv/issues/602
Update: I have attempted to create a solution based on what I thought the option above was doing, but to no avail:
over <- function(repo, record) {
if (!grepl('r[-]universe[.]dev.?$', repo)) return(NULL)
vsn <- gsub("[^.0-9]", '', suppressWarnings(readLines(paste0(repo, "/packages/", record$Package))))
vsn <- vsn[vsn != '']
url <- contrib.url(repo, type = "binary")
sfx <- if (grepl("macos", url)) ".tgz" else if (grepl("windows", url)) ".zip" else ".tar.gz"
paste0(url, "/", record$Package, "_", vsn, sfx)
}
The issue here is that the option above is indeed looking for an archive link that will have that specific version, so we end up with errors like this:
Retrieving 'https://carpentries.r-universe.dev/src/contrib/stringi_1.7.5.tar.gz/stringi_1.7.4.9001.tar.gz' ...
Retrieving 'https://cran.rstudio.com/src/contrib/Archive/stringi/stringi_1.7.4.9001.tar.gz' ...
Error: failed to retrieve package 'stringi'
In addition: Warning messages:
1: curl: (22) The requested URL returned error: 404 Not Found
2: curl: (22) The requested URL returned error: 404 Not Found
The solution here is to use sandpaper::pin_version()
and rebuild, but that's not really all that satisfying.
François tried out creating a new repository with {sandpaper} and he ran into an interesting problem: because he installed his {renv} package from https://zkamvar.r-universe.dev, there was a problem he ended creating a lockfile that could not be restored because it contained a repository that was not listed at the top:
https://github.com/fmichonneau/test-renv/blob/991dba347bfd65c3e49f49537b982b92d1cee438/renv/profiles/lesson-requirements/renv.lock
He ended up getting this error:
When he re-installed {renv} from CRAN, it worked:
https://github.com/fmichonneau/test-renv-2/blob/main/renv/profiles/lesson-requirements/renv.lock