rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
971 stars 152 forks source link

Package lazy load failing on GHA workflow #1887

Closed jimjam-slam closed 1 month ago

jimjam-slam commented 1 month ago

Not sure if this is related to #1886; it presents as a different issue, but like @jzadra, my GHA workflows also started failing 5 days ago.

In my case, ggplot2 3.4.2 downloads from CRAN but fails to install:

- Installing viridisLite ...                    OK [built from source and cached in 1.1s]
- Installing scales ...                         OK [built from source and cached in 3.6s]
Error: Error: Error installing package 'ggplot2':
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) : 
  invalid non-character version specification 'x' (type: double)
Error: Error: unable to load R code in package ‘ggplot2’
Execution halted
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/runner/work/tracker-seaice/tracker-seaice/renv/staging/1/ggplot2’
install of package 'ggplot2' failed [error code 1]
- Installing ggplot2 ...                        FAILED

Not sure if this is a renv problem or if there's an uncontrolled dependency in the workflows' build tools that is causing it (I can see that the runner version has moved from 2.315.0 to 2.316.0).

Here are two workflows that are failing:

kevinushey commented 1 month ago

I suspect this is due to changes in R 4.4.0. You likely need to update the versions of R packages used in your workflow as well, as a number of these packages required updates on CRAN to adapt to changes in the numeric_version() function.

jimjam-slam commented 1 month ago

Thanks very muh, @kevinushey! Upon investigation, I realised I hadn't told my workflows to refer to the lockfile for the R version (even though I was restoring packages from one):

- uses: r-lib/actions/setup-r@v2

Now I've fixed that and things are running well:

- uses: r-lib/actions/setup-r@v2
    with:
      r-version: renv

I'll probably wait a while before moving workflows to R 4.4.0!