"Cache not found" error when using r-lib/actions/setup-r-dependencies@v2

Using r-lib/actions/setup-r-dependencies@v2 generates a "Cache not found" error message. Details from the log:

Run actions/cache@v3
  with:
    path: /home/runner/work/_temp/Library/*
  !/home/runner/work/_temp/Library/pak
  
    key: Ubuntu 22.04.2 LTS-R version 4.2.2 (2022-10-31)-1-a6963a73c7acabb3d90df0a13f0988a425a2f4c9520de685f5758c4f73dbc2fd
    restore-keys: Ubuntu 22.04.2 LTS-R version 4.2.2 (2022-10-31)-1-
    enableCrossOsArchive: false
    fail-on-cache-miss: false
    lookup-only: false
  env:
    GITHUB_PAT: ***
    R_KEEP_PKG_SOURCE: yes
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RSPM: https://packagemanager.posit.co/cran/__linux__/jammy/latest
    RENV_CONFIG_REPOS_OVERRIDE: https://packagemanager.posit.co/cran/__linux__/jammy/latest
    R_LIB_FOR_PAK: /home/runner/.cache/R/renv/library/all.primer.tutorials-ad465717/R-4.2/x86_64-pc-linux-gnu
Cache not found for input keys: Ubuntu 22.04.2 LTS-R version 4.2.2 (2022-10-31)-1-a6963a73c7acabb3d90df0a13f0988a425a2f4c9520de685f5758c4f73dbc2fd, Ubuntu 22.04.2 LTS-R version 4.2.2 (2022-10-31)-1-

In other packages I created, it works fine.

Any suggestions?

This is because you use renv, and renv installs packages in a different location than what setup-r-dependencies uses. There is a setup-renv action for renv projects, I assume that will save the right directories in the cache, so you might want to try that instead of setup-r-dependencies.

Thanks @Gabor! But I still get an error with setup-renv, but only if I am using the rstanarm package. Here is a simple package which illustrates the behavior:

...
Moving threejs [0.3.3] into the cache ...
	OK [moved to cache in 17 milliseconds]
Installing shinystan [2.6.0] ...
	OK [installed binary in 0.37 seconds]
Moving shinystan [2.6.0] into the cache ...
	OK [moved to cache in 19 milliseconds]
Installing rstanarm [2.21.3] ...
	FAILED
Error installing package 'rstanarm':
====================================

* installing *source* package ‘rstanarm’ ...
** package ‘rstanarm’ successfully unpacked and MD5 sums checked
** using staged installation
Error: Error in loadNamespace(x) : there is no package called ‘roxygen2’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
** libs
"/opt/R/4.2.2/lib/R/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
Wrote C++ file "stan_files/bernoulli.cc"


g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -I"../inst/include" -I"/home/runner/work/testing/testing/renv/staging/1/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'/home/runner/work/testing/testing/renv/staging/1/StanHeaders/include' -I'/home/runner/work/testing/testing/renv/staging/1/rstan/include' -I'/home/runner/work/testing/testing/renv/staging/1/BH/include' -I'/home/runner/work/testing/testing/renv/staging/1/Rcpp/include' -I'/home/runner/work/testing/testing/renv/staging/1/RcppEigen/include' -I'/home/runner/work/testing/testing/renv/staging/1/RcppParallel/include' -I/usr/local/include  `"/opt/R/4.2.2/lib/R/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"/opt/R/4.2.2/lib/R/bin/Rscript" -e "StanHeaders:::CxxFlags()"` -fpic  -g -O2  -c stan_files/bernoulli.cc -o stan_files/bernoulli.o
In file included from /home/runner/work/testing/testing/renv/staging/1/RcppEigen/include/Eigen/Core:397,
                 from /home/runner/work/testing/testing/renv/staging/1/RcppEigen/include/Eigen/Dense:1,
                 from /home/runner/work/testing/testing/renv/staging/1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from /home/runner/work/testing/testing/renv/staging/1/rstan/include/rstan/rstaninc.hpp:3,
                 from stan_files/bernoulli.hpp:18,
                 from stan_files/bernoulli.cc:3:
/home/runner/work/testing/testing/renv/staging/1/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128’ [-Wignored-attributes]
   60 | template<> struct is_arithmetic<__m128>  { enum { value = true }; };
...

Without rstanarm, it works fine. Any suggestions?

Seems like rstanarm needs roxygen2 without declaring it as a required dependency. So you can add it to your renv lock file.

Thanks @Gabor . Alas, that did not solve the problem. Since title of this thread no longer describe the problem that I am having, I will move this discussion to a new post.

This topic was automatically closed after 45 days. 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.