check-standard.yaml fails to install system dependencies on macOS and Windows.

I'm moving from Travis to GitHub Actions for an R package I'm a developer on, and I'm running into an issue with check-standard.yaml. The check works fine on Ubuntu 20.04 release and devel, but fails on macOS and Windows. In both cases, it fails because a vignette requires the rjags package which fails to install on macOS and Windows due to the absence of the JAGS system library.

In both cases, rjags seems to install without issue, and then causes an error when trying to render the vignette because the runner is unable to load the missing JAGS system library. The following code in check-standard.yaml makes it seem like system dependencies are only installed on linux runners:

- name: Install system dependencies
  if: runner.os == 'Linux'
  run: |
    while read -r cmd
    do
      eval sudo $cmd
    done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')

The documentation for remotes::system_requirements() says that it does support Windows but does not support macOS (see https://github.com/rstudio/r-system-requirements#operating-systems). However, remotes::system_requirements() doesn't support Windows yet, because it says the API doesn't support it yet (see https://github.com/r-lib/remotes/blob/master/R/system_requirements.R).

At this point, is the best practice to just manually install JAGS for macOS using brew? Also, JAGS doesn't seem to be available via Chocolatey, so what would be the best way to install a system dependency I can't just choco install?

The macOS error is below:

Error: --- re-building ‘getting_started.Rmd’ using rmarkdown
Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2
Loading required package: rjags
Loading required package: coda
Error: Error: package or namespace load failed for 'rjags':
 .onLoad failed in loadNamespace() for 'rjags', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Users/runner/work/_temp/Library/rjags/libs/rjags.so':
  dlopen(/Users/runner/work/_temp/Library/rjags/libs/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.4.dylib
  Referenced from: /Users/runner/work/_temp/Library/rjags/libs/rjags.so
  Reason: image not found

The Windows error is below:

Loading required package: rjags

Loading required package: coda

Error: Error: package or namespace load failed for 'rjags':

 .onLoad failed in loadNamespace() for 'rjags', details:

  call: fun(libname, pkgname)

  error: Failed to locate any version of JAGS version 4



The rjags package is just an interface to the JAGS library

Make sure you have installed JAGS-4.x.y.exe (for any x >=0, y>=0) from

http://www.sourceforge.net/projects/mcmc-jags/files

Of course, 10 minutes after I posted this I found a .yaml file from someone who'd figured it out. See here: https://github.com/soniamitchell/SpARKjags/blob/1df302b209a0c54b263968ad80e662b72d746763/.github/workflows/test-build.yaml.

- name: Install jags (windows-latest)
  if: runner.os == 'Windows'
  run: |
    curl.exe -o wjags.exe --url https://deac-fra.dl.sourceforge.net/project/mcmc-jags/JAGS/4.x/Windows/JAGS-4.2.0-Rtools33.exe
    wjags.exe /S
    del wjags.exe
  shell: cmd

- name: Install jags (macOS-latest)
  if: runner.os == 'macOS'
  run : |
    rm '/usr/local/bin/gfortran'
    brew install jags

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.