CredibilityLab / groundhog

Reproducible R Scripts Via Date Controlled Installing & Loading of CRAN & Git Packages
https://groundhogr.com/
GNU General Public License v3.0
78 stars 4 forks source link

Error fetching package - Archive not available of current version of package. #98

Closed barticus closed 1 year ago

barticus commented 1 year ago

Hello!

Thanks a lot for working on Groundhog, its been a real timesaver and very cool. I'm trying to install some packages for a given date, but one of the peer dependencies is failing

Code (for a sense check):

pkgs <- c(
 ...about 20 packages
)

groundhog.library(pkgs, "2020-01-15", include.suggests = TRUE, force.install = TRUE, cores=1)

Error:

Error in download.file(p, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cloud.r-project.org/src/contrib/Archive/R2wd/R2wd_1.5.tar.gz'

This error appears accurate, there is no package at that URL, there are only versions up to 1.4 of R2wd in the archive, because v1.5 is the active one.

Because there are so many packages, I'm hoping for a way to avoid needing to install particular ones manually, and was wondering if this was a bug in Groundhog or a bug with CRAN or a bug with that packages definition.

Thanks!

urisohn commented 1 year ago

OK, I will need more details to get to the bottom of it.

But I can tell you a few things.

Using Windows and R-4.2.3 I was able to install R2wd 1.5.0 both from binary and from source. groundhog.library('R2wd','2020-01-15) groundhog.library('R2wd','2020-01-15',tolerate.R.version = '4.2.3',force.source=TRUE,force.install=TRUE)

But, when I installed it, groundhog looked for the source file where it should look for it: https://cran.rstudio.com/**src/contrib/**R2wd_1.5.tar.gz

That version of R2wd is the last one released, so it is no in the CRAN archive, but on the main folder (notice how my URL does not have 'archive' in it).

Your groundhog was looking for it in the wrong place, where archived (non-current) versions of the pkg are.

I don't know why it looked in the wrong place, and to get to the bottom of it i will need to know a bit more What OS you are using and R version, and perhaps the full console output generated when you ran it.

Note that I use a different CRAN mirror, but the one you are using also does have it stored in the place it should be. https://cloud.r-project.org/src/contrib/R2wd_1.5.tar.gz

barticus commented 1 year ago

Thanks for getting back to me Uri.

I am running this within docker on an ubuntu focal (glibc 2.31) and R version 3.6.3. This is a legacy project so trying to get it running again with its original dependencies.

I've worked around this for the moment by just installing it directly, and turning off suggested installs (so I'm guessing this was just a suggestion on one of the packages).

The console logs were really not much more detailed - the download is essentially the first step + then throws the above error, and the suggested debugging steps of trying again, etc.

Thanks!

urisohn commented 1 year ago

Ok, will try it on ubuntu, but probably not today.

You don't have to turn off suggested Instead, prior to the groundhog call load this particular package with library(). When you run groundhog after it, it will see that the version it wants is already available and move on. If it doesn't like it, use ignore.deps='R2wd', but i think it should be fine.

barticus commented 1 year ago

Oh, so my install line is now

groundhog.library(pkgs, "2020-01-15", include.suggests = FALSE, force.install = TRUE)

The other change that might have had an impact is the cores limit of 1 being removed.

Thanks, I do now have the line to install R2wd with install.packages, it did seem that this didn't work on first try. But appreciate the syntax for the ignore.deps arg, I thought it was an "all or nothing" value.

barticus commented 1 year ago

Ah, I've found why:

Warning message:
package ‘R2wd’ is not available (for R version 3.6.3)