pak icon indicating copy to clipboard operation
pak copied to clipboard

Install older version if current CRAN version requests a too recent version of R

Open krlmlr opened this issue 2 years ago • 6 comments

DiagrammeR requires R 3.5 as of version 1.0.7: https://github.com/rich-iannone/DiagrammeR/commit/6812dee9ba3b803a20832a0a72e0a74924f0d2fc#diff-9cc358405149db607ff830a16f0b4b21f7366e3c99ec00d52800acebe21b231cR20 . As a consequence, workflows on R 3.4 that try to install DiagrammeR now fail: https://github.com/r-lib/pillar/runs/4892581824?check_suite_focus=true#step:4:1044

Could pak install DiagrammeR 1.0.6 in this situation?

I searched the issues for "older", sorry if I missed a duplicate.

krlmlr avatar Jan 21 '22 06:01 krlmlr

Unfortunately this is not feasible to do automatically, because there is no metadata available for older packages. So we would need to download (potentially a lot of) packages and extract them to see what their dependency requirements are.

OTOH you can solve this manually, by specifying the version you want in extra-packages, either using a URL remote or using the github.com/cran mirror:

- uses: r-lib/actions/setup-r-dependencies@v2
  with:
    extra-packages: cran/[email protected], ...

This is not R version dependent of course, so if you only want it to apply to R 3.4, then you'll need two r-lib/actions/setup-dependencies steps, one for R 3.4 and one for the other R versions.

gaborcsardi avatar Jan 21 '22 08:01 gaborcsardi

Btw. if DiagrammeR is not a hard dependency, you can also ignore it (on R 3.4), like this: https://github.com/r-lib/actions/tree/v2-branch/setup-r-dependencies#ignoring-optional-dependencies-that-need-a-newer-r-version

gaborcsardi avatar Jan 21 '22 08:01 gaborcsardi

Thanks. I can work with the ?ignore-before-r= syntax. Would you consider an optional "best effort mode" for suggested dependencies? In this mode the failure would be turned to a message but the installation would succeed (minus DiagrammeR).

krlmlr avatar Jan 22 '22 10:01 krlmlr

In general I don't like the idea of doing this automatically, because you just don't know what exactly is going to be installed. This is basically what install.packages() does, and we didn't have a great experience with it.

gaborcsardi avatar Jan 22 '22 14:01 gaborcsardi

Does pak maintain its own metadata cache? Is that cache cached on GHA?

Determining the maximum supported version for a particular CRAN package would mean to download sequentially, but only once. This would greatly increase the experience on older R installations.

krlmlr avatar Jan 23 '22 03:01 krlmlr

No, there is no such metadata stored anywhere.

Well, except for https://crandb.r-pkg.org/ of course. In theory we could use that, but it is far from trivial, because it is too big to just put it in the pak dependency solver.

gaborcsardi avatar Jan 23 '22 09:01 gaborcsardi

There isn't anything actionable about this, so I am going to close it now.

gaborcsardi avatar Nov 01 '23 13:11 gaborcsardi