27.2 Github Actions
This section is very incomplete, but I’m gonna start writing reminders to myself:
- Github Actions won’t find new packages that I recently added to the notes unless the
renv.lock
file is updated. So gotta userenv::snapshot()
and commit therenv.lock
file to the repo after adding a new package. - If
pubtheme
has been updated and re-installed on my machine, I need to reinstall it viadevtools::install_github("bmacGTPM/pubtheme")
. If I install it from thepubtheme
package R project Build -> Install, then I thinkrenv
won’t be able to automatically detect where the packages comes from. Therenv.lock
will say source unknown. It’s not reproducible on another machine. If, however, I install it from Github, which is reproducible on another machine, thenrenv
will auto-detect the source and all will be well. - When updating packages, I should remember to install the binary versions when the source version is more recent. Github Actions wasn’t able to find these. So I had to reinstall the binary versions. If the project has been activated, check which packages are binary and which are source with
renv::status()
. If it hasn’t been activated (like the first time I dealt with this), I installed a package that gave an error in Github Actions, reran Github Actions, see which package errored, install the binary version, and repeat. - It seems like the Windows repo and Linux repo don’t have the same package versions. For plotly, I downloaded 4.10.4, but version 4.10.3 was listed here
I installed an earlier version using this
devtools::install_version("plotly",
version = "4.10.3",
repos = "http://cran.us.r-project.org")
terra
was failing on Github Actions. I tried this to reinstall all packages that depend onterra
## Check for dependencies, and reinstall all packages
d1 = revdep('terra')
d2 = installed.packages()
re.install = d1[d1 %in% d2[,'Package']] ## d2 is matrix, can't use $
if (length(re.install) > 0) {
install.packages(re.install, dependencies=TRUE)
}
## Check for dependencies, and reinstall all packages
d1 = revdep('units')
d2 = installed.packages()
re.install = d1[d1 %in% d2[,'Package']] ## d2 is matrix, can't use $
if (length(re.install) > 0) {
install.packages(re.install, dependencies=TRUE)
}
## then use code like this
devtools::install_version('tidycensus', version = '1.1')
devtools::install_version('sf', version = '1.0-2')
devtools::install_version('units', version = '0.7-2')
devtools::install_version('raster', version = "3.4-13")
- I had issues with
units
, which is needed forsf
, which is needed fortidycensus
. So I removedtidycensus
for now.- The error says
libudunits2.so.0: cannot open shared object file: No such file or directory
. This is related to an Ubuntu library, and NOT the R libraryubunits2
- I added
sudo apt-get install libudunits2-dev
to the yaml file and that worked. See.github/bookdown.yaml
. Then I addedlibproj-dev
andlibgdal-dev
because I got similar errors to the above, in particular,xxxxxxx.xx.x: cannot open shared object file: No such file or directory
- The error says
- I had issues with
terra
, which is needed forraster
, which is needed forleaflet.
Butterra
wasn’t needed for the earlier version3.4-13
ofraster
that I was using. So installed that version. Didn’t work. Tried downloading the dev version of terra usinginstall.packages('terra', repos='https://rspatial.r-universe.dev')
. Did this work? - Temporary fix: remove 50*.Rmd files, which require leaflet, from the main folder into the R folder