R CMD check on github actions failing suddenly with missing renv ${VERSION}

I'm writing an R package and running R CMD check on github actions. everything was passing fine until one commit which did not make any changes to any of the renv files or workflow files and passed R CMD check fine locally, but failed on gihtub. The error i am getting is

Error: Error in bootstrap(version, libpath) : failed to download renv ${VERSION}
(click below for the whole output)

These are the actions in question. I have tried adding env: RENV_VERSION: 0.17.3 to the workflow yaml file, but it's not worked. I'm not sure what broke this, or where to look next?

Click for whole run output

Run r-lib/actions/check-r-package@v2

2 with:

3 upload-snapshots: true

4 args: c("--no-manual", "--as-cran")

5 build_args: "--no-manual"

6 error-on: "warning"

7 check-dir: "check"

8 working-directory: .

9 upload-results: false

10 env:

11 GITHUB_PAT: ***

12 R_KEEP_PKG_SOURCE: yes

13 R_LIBS_USER: /home/runner/work/_temp/Library

14 TZ: UTC

15 R_CHECK_SYSTEM_CLOCK: FALSE

16 NOT_CRAN: true

17 RSPM: https://packagemanager.posit.co/cran/__linux__/jammy/latest

18 RENV_CONFIG_REPOS_OVERRIDE: https://packagemanager.posit.co/cran/__linux__/jammy/latest

19 RENV_PATHS_ROOT: /home/runner/work/_temp/renv

20Run ## --------------------------------------------------------------------

39Warning message:

40renv 0.17.3 was loaded from project library, but this project is configured to use renv ${VERSION}.

41Use renv::record("renv@0.17.3") to record renv 0.17.3 in the lockfile.

42Use renv::restore(packages = "renv") to install renv ${VERSION} into the project library.

43── R CMD build ─────────────────────────────────────────────────────────────────

44* checking for file β€˜.../DESCRIPTION’ ... OK

45* preparing β€˜UMARfetchR’:

46* checking DESCRIPTION meta-information ... OK

47* installing the package to build vignettes

48 -----------------------------------

49# Bootstrapping renv ${VERSION} ----------------------------------------------

50Error: Error in bootstrap(version, libpath) : failed to download renv ${VERSION}

51Calls: source ... eval.parent -> eval -> eval -> eval -> eval -> bootstrap

52Execution halted

53 -----------------------------------

54ERROR: package installation failed

55Error: Error in proc$get_built_file() : Build process failed

56Calls: ... build_package -> with_envvar -> force ->

57Execution halted

58Error: Process completed with exit code 1.

59Run ## --------------------------------------------------------------------

60 ## --------------------------------------------------------------------

61 echo ::group::Show testthat output

62 find check -name 'testthat.Rout*' -exec cat '{}' ; || true

63 echo ::endgroup::

64 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}

65 env:

66 GITHUB_PAT: ***

67 R_KEEP_PKG_SOURCE: yes

68 R_LIBS_USER: /home/runner/work/_temp/Library

69 TZ: UTC

70 R_CHECK_SYSTEM_CLOCK: FALSE

71 NOT_CRAN: true

72 RSPM: https://packagemanager.posit.co/cran/__linux__/jammy/latest

73 RENV_CONFIG_REPOS_OVERRIDE: https://packagemanager.posit.co/cran/__linux__/jammy/latest

74 RENV_PATHS_ROOT: /home/runner/work/_temp/renv

75 LOGNAME: runner

76Show testthat output

77Run actions/upload-artifact@v3

78 with:

79 name: Linux-rdevel-results

80 path: /home/runner/work/UMARfetchR/UMARfetchR/check

81 if-no-files-found: warn

82 env:

83 GITHUB_PAT: ***

84 R_KEEP_PKG_SOURCE: yes

85 R_LIBS_USER: /home/runner/work/_temp/Library

86 TZ: UTC

87 R_CHECK_SYSTEM_CLOCK: FALSE

88 NOT_CRAN: true

89 RSPM: https://packagemanager.posit.co/cran/__linux__/jammy/latest

90 RENV_CONFIG_REPOS_OVERRIDE: https://packagemanager.posit.co/cran/__linux__/jammy/latest

91 RENV_PATHS_ROOT: /home/runner/work/_temp/renv

92 LOGNAME: runner

93Warning: No files were found with the provided path: /home/runner/work/UMARfetchR/UMARfetchR/check. No artifacts will be uploaded.

edit: typos

1 Like

Why are you deleting the R profile? According to the documentation at https://github.com/r-lib/actions/tree/v2/setup-renv#usage you don't need to do that.

Hi Gabor, not sure where in the linked documentation you see that, I cannot find it? Also i actually had issues when i kept the .Rprofile for githubactions, which is why i followed the solution posted here , which suggests removing it to avoid conflicts with renv. Either way, this was never an issue before (and my .Rprofile's main funciton is setting up my proxies for my work network, so that is definitely not an issue on github).

The example in the docs is

steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-renv@v2
  with:
    profile: '"shiny"'

and it is a good thing to follow examples. Hence my question why you added the removal of .Rprofile.

Can you link to such a build, please?

Well, maybe you used it for that as well, but renv creates an .Rprofile and uses it for its own purposes. E.g. this is an .Rprofile from an renv project:

❯ cat .Rprofile
source("renv/activate.R")

It is possible that the profile has nothing to do with the errors, but it would be great to see if the error happens when using the example from the documentation.

I removed it because i was having issues (in another package) and that's what the documentation suggested. I cannot pinpoint the specific commit - and there was probably other stuff going on anyway.

I appreciate your effort though, i have just commited just this changed workflow with the .Rprofile removal deleted, and you can see the failed actions here.

Are you sure that you need to set the proxies and also run that extra code on GitHub? Do the proxies you set work from GitHub at all?

No, that's exactly why i am removing the .Rprofile on github, i only need it locally.

Sure, but you still need the first line of the .Rprofile file, renv and/or r-lib/actions/setup-renv need that. Look at the builds and the commits here:

So if you still want to include your local setup in .Rprofile, make sure that only the first line runs on GitHub Actions. E.g. put the rest into

if (Sys.getenv("CI") != "true") {
  ...
}

(See Variables - GitHub Docs)

Can you tell me where the docs suggest that? It is probably a mistake. Thanks.

I'm sorry, but not sure i understand what you are trying to say. I have never had any issue running renv on github actions with .Rprofile removed, in this package or in others.

From what i understand the first line of .Rprofile you are refering to is renv::activate(), but that is taken care of by setup-renv (line 25 here), so it makes sense that it would work fine if .Rprofile is removed. Which is also what the documentation says here is the link again. I really appreciate your effort, but i am quite confident this is not the reason for these failures. If anything the documentation should more clearly indicate that .Rprofile can be removed without any problems.

OK, sorry, I checked your actions, now i am really confused, we both did the same commit removing the .Rprofile block and yours passed and mine didn't, how does this work?

Look at the other commits as well, I kept an .Rprofile with the single renv::activate() line. Having this line in the profile, and calling it once from the action might not be the same.

I suspect that the behavior change is related to the renv 1.0.0 release.

We might need to revisit the docs at solutions.posit.co, I am afraid, I'll contact its owners to take another look.

TBH I am mostly just guessing here, I don't know renv well, but hopefully this will give you a way to fix your workflows.

Btw. it would make sense to tag this post with renv, so the right people see it.

Yeah, i see it now.

I'm still confused about how this happened - i mean you are right the renv 1.0.0 release coincides with the issue appearing, but my workflow should still be using 0.17.3? I mean it is beyond ironic that a version change in a package meant to protect you from version changes is breaking my project?

I guess i'll try to set up a minimal working example and open an issue on the renv repo and see what they say. Thanks again for your efforts!

I suspect that the need of removing .Rprofile comes from an renv or r-lib/actions/setup-renv bug that was never fixed or possibly even reported, and it was just a coincidence that it all worked without the .Rprofile.

And possibly the new renv version is less forgiving for the missing .Rprofile.

Nevertheless, reporting an issue sounds great. I also asked the solution engineering team to look at those docs again.

I'm getting so confused now :face_with_spiral_eyes:

  • i removed the .Rprofile removal code and put the rest of the code into the if (Sys.getenv("CI") == "true") like you suggested, but it's still failing here. This is exactly what you did, isn't it?

On the other hand i created a minimal working example repo:

  • where i don't even have an .Rprofile at all and it is passing the checks fine (see here)
  • i then added only the one-line .Rprofile, and they all fail (see here
  • and then i added the rprofile removal to the workflow and its passing again. (here)

which is just the inverse of what you got, no?

Also, i am noticing odd behaviour that i don't quite understand with regard to the renv global cache, which i found in C:\Users\mzaloznik\AppData\Local\R\cache\R\renv\library, namely this folder is full of folders, one per commit it seems basically, which however only have renv inside.
image
each of these folders essentially looks like this: UMARfetchR-18fe064e\R-4.1\x86_64-w64-mingw32\renv.

Except for the oldest folder, which has the whole library, the others all have renv only. but they only start appearing at a certain time, which is different for different packages.
Any ideas what i am looking at?

edit: It seems i don't have project specific libraries, there is no renv/library folder in my project, i have no idea how this happened..

Sorry, it should be

if (Sys.getenv("CI") != "true") {

I.e. only run this if CI is no set to true.

Ah, serves me right for copy/pasting without thinking, but after fixing that line the checks are still failing:
see here

That seems a bug in renv or setup-renv to me, I am not sure why setup-renv installs renv 1.0.0, if the requested version is already installed.

And then renv 0.x.y probably fails because version 1.0.0 is installed on disk.

Can you try to change r-lib/actions/setup-renv@v2 to r-lib/actions/setup-renv@v2-branch to see if I just fixed this in the dev version of r-lib/actions? If this works, then I'll make a release and you can switch back. Thanks!

2 Likes

Looks like it's working, both on the test repo and on mine :raised_hands:

Thanks for your patience GΓ‘bor, i still don't know what happened, but seeing those green ticks again is making me tear up :face_holding_back_tears:

Great! My mildly educated guess is that

  • setup-renv was always buggy w.r.t. installing renv twice, and potentially installing an incompatible version if renv's .Rprofile was present.
  • to work around this people started suggesting removing .Rprofile, but still meant that setup-renv potentially installed a different version of renv than prescribed.
  • the removing .Rprofile trick started failing (at least for some projects) when renv 1.0.0 came out.

Don't forget to change back to setup-renv@v2 in a couple of days, once I release it.