As you are on Ubuntu 22.04, you can rely on binaries from r2u. Earlier today I just replied to someone on Mastodon with a similar question for just sf
and prepared a demo in a quick mp4 I cannot post here because of the file size limit but you can read the post with its demo or just look at the mp4 video demo.
It would be the same for your issue -- on an Ubuntu system where the r2u apt
repo has been added and bspm
been added you just do
install.packages(c("terra", "raster", "vis", "rgdal", "sf"))
I just did in a r2u
container and it took all of 25 seconds to install a total of 70 binary .deb packages.
Edit: To illustrate, for example for package sf
we automatically resolve to
$ root:/# apt-cache show r-cran-sf
Package: r-cran-sf
Architecture: amd64
Version: 1.0-12-1.ca2204.1
Priority: optional
Section: gnu-r
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Installed-Size: 7203
Depends: libc6 (>= 2.32), libgcc-s1 (>= 3.0), libgdal30 (>= 3.4.0), libgeos-c1v5 (>= 3.10.0), libproj22 (>= 7.1.0), libstdc++6 (>= 11), r-base-core (>= 4.2.2), r-api-4.0, r-cran-classint, r-cran-dbi, r-cran-magr
ittr, r-cran-rcpp, r-cran-s2, r-cran-units
Suggests: r-cran-blob, r-cran-covr, r-cran-dplyr, r-cran-ggplot2, r-cran-knitr, r-cran-lwgeom, r-cran-maps, r-cran-mapview, r-cran-matrix, r-cran-microbenchmark, r-cran-odbc, r-cran-pbapply, r-cran-pillar, r-cra
n-pool, r-cran-raster, r-cran-rlang, r-cran-rmarkdown, r-cran-rpostgres, r-cran-rpostgresql, r-cran-rsqlite, r-cran-sp, r-cran-spatstat, r-cran-spatstat.geom, r-cran-spatstat.random, r-cran-spatstat.linnet, r-cr
an-spatstat.utils, r-cran-stars, r-cran-terra, r-cran-testthat, r-cran-tibble, r-cran-tidyr, r-cran-tidyselect, r-cran-tmap, r-cran-vctrs, r-cran-wk
Filename: pool/dists/jammy/main/r-cran-sf_1.0-12-1.ca2204.1_amd64.deb
Size: 3075194
MD5sum: 8cb3721102e9b1051e3020c52b8a6ca3
SHA1: a53e6f195177a5fadb5ddb5bcabf110d5de8a920
SHA256: 7eeddaf172251dd9eeaf806b0f5b071bbfc98c22b6feee951c38c6e07c9bc4bf
SHA512: 3c08529dd9bd9963e2689dc9d9de6291d0e51d8290a20a97f51ec911254871ede030a470be77b5a1fe1d9e02895b0f8ceabb3252f3cbb8c6ccd8d10b83b4894e
Homepage: https://cran.r-project.org/package=sf
Description: CRAN Package 'sf' (Simple Features for R)
Support for simple features, a standardized way to encode spatial vector
data. Binds to 'GDAL' for reading and writing data, to 'GEOS' for
geometrical operations, and to 'PROJ' for projection conversions and datum
transformations. Uses by default the 's2' package for spherical geometry
operations on ellipsoidal (long/lat) coordinates.
Description-md5: cb73ad855572663ce996c8621e813bfb
$ root:/#
which shows exactly which graphics libraries are needed and supplied:
libgdal30 (>= 3.4.0), libgeos-c1v5 (>= 3.10.0), libproj22 (>= 7.1.0)
and ditto with the needed R packages
r-cran-classint, r-cran-dbi, r-cran-magrittr, r-cran-rcpp,
r-cran-s2, r-cran-units
each of which of course bring their dependencies in. And best of all: no compilation, no failure, no errors, and near-immediate access.
Give it a try, you can even try r2u
in your browser thanks to https://gitpod.io (if you sign up, eg with your github id). See the link at the end of https://eddelbuettel.github.io/r2u/