Github Action fail (cant find a pre-installed package)

Hello. I created a github action and I get this error:

Run Rscript -e 'source("auto workflow.R")'

[9]( Error in library(rvest) : there is no package called β€˜rvest’

However, In my yaml file I do install rvest:

        run: Rscript -e 'install.packages(c("collapse", "rvest","stringi","tidyverse"))'

And this install job runs with no issues.
It suppose to run a auto workflow.R file that then runs the full script. Here is a link to my GitHub Repo

What do you think is the issue?
Oh and BTW feel free to clone and do some cool analysis on it! I hope to automate it, but for now I maintain a weekly update of the episodes of the R weekly podcast!


You failed to install the dependencies because system packages are missing:

install.packages() does not fail if a package fails to install, which is obviously not great.

I suggest you try GitHub - r-lib/actions: GitHub Actions for the R community with a fake DESCRITPION file that defines your dependencies. It will install the system packages (on Linux) automatically.

Alternatively, you can install the Ubuntu packages manually in the GitHub workflow.

1 Like

Hey Gabor, thanks.
I am writing this project outside of the context of a package, and I don't have a description file.

Would you suggest using a lock file from renv to make sure my dependencies are installed instead maybe?

Or, is there a pre-made job from the r-lib which already installs system libraries?

I am not sure about the ubunto-packages. If you have a reliable reference for further reading that would also do the trick. I found various sources online regarding the whole automation process and I realise i didn't go through any official documentation or process.

Thanks again

You do not need to create a package. If you create a DESCRIPTION file it will serve as a lock file and you can use setup-r-dependencies to to install system packages (on Linux) and R packages.

Here is an example that is a book and not a package. The DESCRIPTION file:

and the GHA workflow:

1 Like

Thank you so very much for the help.
I will get on to implement (and learn....).


I took a diff approach and used renv. Now the failure is at something i am not sure i have to do with:
Error: Error: Error installing package 'curl':
and mainly, Package libcurl was not found in the pkg-config search path.

I really thought that one would work :
Any thought? I feel like I butchered my yml workflow by now. im really in the dark here

renv does not install system packages, so you'll need to install them manually. You can still use pak to look up the system packages you need. E.g.

❯ pak::pkg_sysreqs(c("rvest", "tidyverse"), sysreqs_platform = "ubuntu-22.04")
βœ” Loading metadata database ... done
── Install scripts ───────────────────────────────────────────── Ubuntu 22.04 ──
apt-get -y update
apt-get -y install libcurl4-openssl-dev libssl-dev libicu-dev libxml2-dev \
  make zlib1g-dev pandoc libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev \
  libfontconfig1-dev libfribidi-dev libharfbuzz-dev

── Packages and their system dependencies ──────────────────────────────────────
curl        – libcurl4-openssl-dev, libssl-dev
fs          – make
haven       – make, zlib1g-dev
knitr       – pandoc
openssl     – libssl-dev
ragg        – libfreetype6-dev, libjpeg-dev, libpng-dev, libtiff-dev
reprex      – pandoc
rmarkdown   – pandoc
sass        – make
stringi     – libicu-dev
systemfonts – libfontconfig1-dev, libfreetype6-dev
textshaping – libfreetype6-dev, libfribidi-dev, libharfbuzz-dev
xml2        – libxml2-dev