problem with renv install errors

Hi there,

I've got a Github Action that builds my bookdown projects whenever a new commit is made. As part of that action, I install some particular versions of packages via renv.

About 80% of the time, it works just fine, but the other 20% of the time, I get an error.

Here's what success looks like in the logs:

283 Run Rscript -e 'renv::install("rmarkdown@2.11")'
284  Rscript -e 'renv::install("rmarkdown@2.11")'
285  Rscript -e 'renv::install("bookdown@0.24")'
286  Rscript -e 'install.packages(c("bslib", "downlit", "xml2"))'
287  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
288  env:
289    R_LIBS_USER: /Users/runner/work/_temp/Library
290    TZ: UTC
291    _R_CHECK_SYSTEM_CLOCK_: FALSE
292    NOT_CRAN: true
293 * Querying repositories for available binary packages ... Done!
294 Retrieving 'https://mran.microsoft.com/snapshot/2022-03-04/bin/macosx/contrib/4.1/rmarkdown_2.11.tgz' ...
295	OK [downloaded 3.4 Mb in 1.3 secs]

And here's what happen when it fails:

283  Run Rscript -e 'renv::install("rmarkdown@2.11")'
284  Rscript -e 'renv::install("rmarkdown@2.11")'
285  Rscript -e 'renv::install("bookdown@0.24")'
286  Rscript -e 'install.packages(c("bslib", "downlit", "xml2"))'
287  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
288  env:
289    R_LIBS_USER: /Users/runner/work/_temp/Library
290    TZ: UTC
291    _R_CHECK_SYSTEM_CLOCK_: FALSE
292    NOT_CRAN: true
293 Error in vapply(x, f, ..., FUN.VALUE = character(1)) : 
294  values must be length 1,
295 but FUN(X[[1]]) result is length 0
296 Calls: <Anonymous> ... renv_install_remotes_update -> renv_description_remotes -> map_chr ->
vapply
297 In addition: Warning messages:
298 1: curl: (22) The requested URL returned error: 403 
299 2: failed to resolve remote 'rstudio/bookdown' from project DESCRIPTION file; skipping 
300 Traceback (most recent calls last):
301 5: renv::install("rmarkdown@2.11")
302 4: renv_install_remotes_update(records, project)
303 3: renv_description_remotes(descpath)
304 2: map_chr(parsed, `[[`, "Package")
305 1: vapply(x, f, ..., FUN.VALUE = character(1))
306 Execution halted
307 Error: Process completed with exit code 1.

It appears that the download of the package is being forbidden, or maybe the check for binary packages itself is failing before the attempt to download a package? Does anybody have any idea why this would happen sometimes, or how I could work around it? Perhaps if I try to get the package from somewhere else?

Any help would be greatly appreciated.

Edit: @cderv, I hate to pester, but if you have a chance would you be willing to take a quick look at this? Do you have any idea either why sometimes renv would fail to install packages like this, or how I could try to work around it? If you can help, my thanks in advance.

1 Like

Based on this output, my guess is that renv is trying to query the GitHub API for information on the rstudio/bookdown repository, but that request is being rejected -- perhaps a rate limit?

Is a GITHUB_PAT set? If so, renv should use that when attempting to query information about the package from the GitHub API.

That said, it's not clear why renv is still reading and parsing the DESCRIPTION file's remotes even when not asked to install from GitHub. You might want to file an issue at Issues · rstudio/renv · GitHub.

1 Like

Thanks for your help. I have a GITHUB_PAT that is available to the action, but I've now added to my Github Action scripts to load a token into my .Renviron. My understanding is that R requests to the Github API weren't necessarily authenticated via by action's token unless I do this. I'll see if it makes a difference.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.