From cd926c591db05c904d088090c3b5157acfe6b492 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 12:04:32 +0000 Subject: [PATCH 1/8] Install new version of terra for a given os --- .github/workflows/R-CMD-check.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 76b77e5c..7e547c89 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -2,7 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master, cran_changes] + branches: [main, master, rcheck] pull_request: branches: [main, master] @@ -20,9 +20,9 @@ jobs: config: - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel-1'} +# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} +# - {os: ubuntu-latest, r: 'release'} +# - {os: ubuntu-latest, r: 'oldrel-1'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -43,6 +43,10 @@ jobs: with: extra-packages: any::rcmdcheck needs: check + + - name: Get dev terra + if: matrix.config.os == macos-latest + run: Rscript "install.packages('terra', repos='https://rspatial.r-universe.dev')" - uses: r-lib/actions/check-r-package@v2 with: From 55824ad0ff1073b23204b68e2afe2d76ee0bd386 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 12:09:05 +0000 Subject: [PATCH 2/8] a --- .github/workflows/R-CMD-check.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7e547c89..7d6506aa 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -45,8 +45,12 @@ jobs: needs: check - name: Get dev terra - if: matrix.config.os == macos-latest - run: Rscript "install.packages('terra', repos='https://rspatial.r-universe.dev')" +# if: matrix.config.os == "macos-latest" +# with: +# os: ${{matrix.config.os}} + run: + print ${{matrix.config.os}} +# Rscript "install.packages('terra', repos='https://rspatial.r-universe.dev')" - uses: r-lib/actions/check-r-package@v2 with: From 430f2a8e5a67cccfbf4758e682179aed277a62b8 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 12:16:33 +0000 Subject: [PATCH 3/8] b --- .github/workflows/R-CMD-check.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7d6506aa..24133fea 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -45,13 +45,13 @@ jobs: needs: check - name: Get dev terra -# if: matrix.config.os == "macos-latest" + if: matrix.config.os == "macos-latest" # with: # os: ${{matrix.config.os}} run: - print ${{matrix.config.os}} -# Rscript "install.packages('terra', repos='https://rspatial.r-universe.dev')" +# echo ${{matrix.config.os}} + Rscript "install.packages('terra', repos='https://rspatial.r-universe.dev')" - - uses: r-lib/actions/check-r-package@v2 - with: - upload-snapshots: true +# - uses: r-lib/actions/check-r-package@v2 +# with: +# upload-snapshots: true From ca50eede9f2b03202ef43eae545ea95b45aeaa80 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 12:18:08 +0000 Subject: [PATCH 4/8] c --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 24133fea..88e6cbb9 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -45,7 +45,7 @@ jobs: needs: check - name: Get dev terra - if: matrix.config.os == "macos-latest" + if: matrix.config.os == 'macos-latest' # with: # os: ${{matrix.config.os}} run: From 45a5280799213d51c2fb8cc0d3b0a2e50a52a334 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 12:22:39 +0000 Subject: [PATCH 5/8] d --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 88e6cbb9..5474fe1d 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -50,7 +50,7 @@ jobs: # os: ${{matrix.config.os}} run: # echo ${{matrix.config.os}} - Rscript "install.packages('terra', repos='https://rspatial.r-universe.dev')" + Rscript -e "install.packages('terra', repos='https://rspatial.r-universe.dev')" # - uses: r-lib/actions/check-r-package@v2 # with: From 30b4233acbc0e688070f016750a711f805f1d062 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 12:28:57 +0000 Subject: [PATCH 6/8] e --- .github/workflows/R-CMD-check.yaml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 5474fe1d..a837332b 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -44,14 +44,13 @@ jobs: extra-packages: any::rcmdcheck needs: check - - name: Get dev terra + - name: Get dev terra for MacOS if: matrix.config.os == 'macos-latest' -# with: -# os: ${{matrix.config.os}} - run: -# echo ${{matrix.config.os}} - Rscript -e "install.packages('terra', repos='https://rspatial.r-universe.dev')" - -# - uses: r-lib/actions/check-r-package@v2 -# with: -# upload-snapshots: true + run: install.packages('terra', repos='https://rspatial.r-universe.dev') + shell: Rscript {0} + +# Rscript -e "install.packages('terra', repos='https://rspatial.r-universe.dev')" + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true From 9528442a784ac2431fedd6373c14cb8f7acdd0dd Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 13:07:46 +0000 Subject: [PATCH 7/8] Testing on all os --- .github/workflows/R-CMD-check.yaml | 12 +++++------ R/zzz.R | 8 +++++--- README.md | 32 +++++++++++++++++++----------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a837332b..b7372435 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master, rcheck] + branches: [master, dev] pull_request: - branches: [main, master] + branches: [master, dev] name: R-CMD-check @@ -20,9 +20,9 @@ jobs: config: - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} -# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} -# - {os: ubuntu-latest, r: 'release'} -# - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -48,8 +48,6 @@ jobs: if: matrix.config.os == 'macos-latest' run: install.packages('terra', repos='https://rspatial.r-universe.dev') shell: Rscript {0} - -# Rscript -e "install.packages('terra', repos='https://rspatial.r-universe.dev')" - uses: r-lib/actions/check-r-package@v2 with: diff --git a/R/zzz.R b/R/zzz.R index c9bb42f9..80d4f671 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -10,9 +10,11 @@ # check that gdal was compiled with netcdf support d <- gdal(drivers=TRUE) if (!"netCDF" %in% terra::gdal(drivers=TRUE)$name){ - stop("the R library terra currently installed relies on a version of gdal that does not support reading netcdf files.", - "You will need to reinstall terra, possibly from source, if there isn't - a version with netcdf support on CRAN.") + stop("The installed version of terra lacks support reading netcdf files.\n", + "pastclim needs netcdf support: you will need to reinstall terra,\n", + "possibly from source, if there isn't a version with netcdf support\n", + "on CRAN. Alternatively, try the latest development version from R-universe:\n", + "install.packages('terra', repos='https://rspatial.r-universe.dev')") } invisible() diff --git a/README.md b/README.md index 7983e020..b42bb685 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,11 @@ [![CircleCI](https://circleci.com/gh/EvolEcolGroup/pastclim/tree/master.svg?style=shield&circle-token=928bdbe8f065e17b22642f66a8b9c13f29f2e3fb)](https://app.circleci.com/pipelines/github/EvolEcolGroup/pastclim?branch=master) +[![R-CMD-check dev](https://github.com/EvolEcolGroup/pastclim/actions/workflows/R-CMD-check.yaml/badge.svg?branch=dev)](https://github.com/EvolEcolGroup/pastclim/actions/workflows/R-CMD-check.yaml) [![codecov](https://codecov.io/gh/EvolEcolGroup/pastclim/branch/master/graph/badge.svg?token=NflUsWlnQR)](https://app.codecov.io/gh/EvolEcolGroup/pastclim) - + This `R` library is designed to provide an easy way to extract and manipulate palaeoclimate reconstructions for ecological and anthropological analyses. @@ -72,20 +70,30 @@ of this issue can be found on [stack**overflow**](https://stackoverflow.com/ques --- -### terra without NETCDF driver for macOS +### `terra` without NETCDF driver for macOS A number of versions of `terra` available as binaries for macOS X86-64 on CRAN (including the latest one) have -been compiled without a NETCDF driver. This prevents `pastclim`, which relies on `terra`, from -correctly reading files. When loaded, `pastclim` checks if the driver is available; in case of +been compiled without a NETCDF driver (the latest ARM library is OK). This prevents `pastclim`, which relies on `terra`, from +correctly reading files. Other packages that rely on `terra` are similarly +affected (e.g. `stars`; see this [bug](https://github.com/r-spatial/stars/issues/566)) + +When loaded, `pastclim` checks if the driver is available; in case of a missing driver, you will get the error: ``` -error: the R library terra currently installed relies on a version of gdal -that does not support reading netcdf files. You will need to reinstall -terra, possibly from source, if there isn't a version with netcdf -support on CRAN." +Error: The installed version of terra lacks support reading netcdf files. +pastclim needs netcdf support: you will need to reinstall terra, +possibly from source, if there isn't a version with netcdf support +on CRAN. Alternatively, try the latest development version from R-universe: +install.packages('terra', repos='https://rspatial.r-universe.dev') ``` -To install `terra` from source, see instructions [here](https://github.com/rspatial/terra). +The easiest solution is probably to install the `dev` version of `terra` from +[R-universe](https://r-universe.dev/organizations/) with: +``` +install.packages('terra', repos='https://rspatial.r-universe.dev') +``` +Alternatively, if you want to install a specific version of + `terra` from source, see instructions [here](https://github.com/rspatial/terra). From 92936b153e7f822eb184496f12a5c9a14758e571 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 30 Nov 2022 13:44:37 +0000 Subject: [PATCH 8/8] Fix typo --- R/zzz.R | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/zzz.R b/R/zzz.R index 80d4f671..972ff65f 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -10,7 +10,7 @@ # check that gdal was compiled with netcdf support d <- gdal(drivers=TRUE) if (!"netCDF" %in% terra::gdal(drivers=TRUE)$name){ - stop("The installed version of terra lacks support reading netcdf files.\n", + stop("The installed version of terra lacks support for reading netcdf files.\n", "pastclim needs netcdf support: you will need to reinstall terra,\n", "possibly from source, if there isn't a version with netcdf support\n", "on CRAN. Alternatively, try the latest development version from R-universe:\n", diff --git a/README.md b/README.md index b42bb685..8f621069 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ When loaded, `pastclim` checks if the driver is available; in case of a missing driver, you will get the error: ``` -Error: The installed version of terra lacks support reading netcdf files. +Error: The installed version of terra lacks support for reading netcdf files. pastclim needs netcdf support: you will need to reinstall terra, possibly from source, if there isn't a version with netcdf support on CRAN. Alternatively, try the latest development version from R-universe: