r-dbi / RSQLite

R interface for SQLite
https://rsqlite.r-dbi.org
GNU Lesser General Public License v2.1
327 stars 79 forks source link

RSQLite compile error on Windows using GitHub Actions #513

Closed anthonysena closed 3 months ago

anthonysena commented 4 months ago

Hi - I'm hoping you can help me with an error I'm facing when running GitHub Actions on my project. This only appears to happen when using the latest Windows and R v4.2.3 & RTools 4.2. Please see the logs that start at: https://github.com/OHDSI/CohortGenerator/actions/runs/9289700700/job/25616598401#step:11:2554 and end: https://github.com/OHDSI/CohortGenerator/actions/runs/9289700700/job/25616598401#step:11:2979.

Please let me know if you need any further details from me. Thanks!

krlmlr commented 4 months ago

Perhaps clear the GitHub Actions cache? Easiest by changing the cache key.

krlmlr commented 4 months ago

(The cache for the installed R packages.)

anthonysena commented 4 months ago

Thanks will give it a try and let you know.

anthonysena commented 4 months ago

From review of my GitHub Action file, there is no caching for R packages on Windows (ref)

Looking closer at the output from the failed run, I found this excerpt from the failure to install RSQLite:

** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: Error: package or namespace load failed for 'RSQLite':
ERROR: loading failed
* removing 'D:/a/_temp/Library/RSQLite'
 .onLoad failed in loadNamespace() for 'RSQLite', details:
  call: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
  error: there is no package called 'cachem'
Error: Error: loading failed

I then noticed a little further along in the output that cachem is installed so it looks like RSQLite would require cachem to be installed first? I'm installing these dependencies via this block:

      - name: Install dependencies
        run: |
          remotes::install_deps(dependencies = TRUE, INSTALL_opts=c("--no-multiarch"))
          remotes::install_cran("rcmdcheck")
        shell: Rscript {0}

So I'm unsure why the installs are not happening in the required order.

krlmlr commented 4 months ago

Thanks for double-checking.

I see the workflow is installing packages from source: https://github.com/OHDSI/CohortGenerator/actions/runs/9289700700/job/25616598401#step:11:1218 .

Is there a specific reason for testing on R 4.2?

What happens if you install cachem manually before running install_deps() ?

You could also consider pak, or moving altogether to the actions provided by https://github.com/r-lib/actions/ (which use pak under the hood).

anthonysena commented 3 months ago

Hi - I'm testing on 4.2 since that's what we currently support for our collection of packages. As you probably saw from the GitHub Actions this does not appear to be an issue on the most recent release of R. I'll see if I can migrate to the newer actions that use pak and potentially install cachem ahead of installing the other dependencies. Thanks!

anthonysena commented 3 months ago

Hi for now I've opted to install cachem before installing the other dependencies as we should be moving towards the latest release of R and we can evaluate using the r-lib/actions as you mentioned. Thanks for your help!