4

There have been many posts regarding problems installing the rgdal package. I've been through lots of them, have tried many of the recommended solutions, but still am having problems. I'm using R4.0.3 on a Mac under OS10.15.7 (Catalina). I use MacPorts for package management. I included the R command I used and the results below, but will highlight what seem to be the problems first:

  1. Error "Failed to locate 'svnversion'. I don't understand this because the previous line in the output reads "checking for /usr/bin/svnversion... yes" and using the terminal "which svnversion" yields "/usr/bin/svnversion". The subsequent message about the command line tools has been discussed elsewhere and I have followed the recommendation to remove the COMMAND_TOOLS directory and install the standalone version; this makes no difference.

  2. gdal-config? It exists and is executable, but this text "cat: inst/SVN_VERSION: No such file or directory" appears before the system answers "yes" to the check of gdal-config usability. Looking for that particular message across the net yielded nothing helpful (to me, at least).

  3. pkg-config proj? I installed proj using MacPorts

    % sudo port install proj

Password: ---> Cleaning proj ---> Scanning binaries for linking errors ---> No broken files found.
---> No broken ports found.

But the system seems to be looking for proj.pc. What is that?

  1. pkg-config: command not found but

    % which pkg-config

/opt/local/bin/pkg-config

I've been playing with this for days and would really appreciate some help, even it is just pointing me to a previous post I may have missed.

From within R I issue the command

install.packages("rgdal", type="source", repos="http://R-Forge.R-project.org", configure.args=c('--with-gdal-config=/opt/local/bin/gdal-config'))

Which results in:

Installing package into ‘/Users/blesht/Library/R/4.0/library’
(as ‘lib’ is unspecified)
trying URL 'http://R-Forge.R-project.org/src/contrib/rgdal_1.5-19.tar.gz'
Content type 'application/x-gzip' length 4375551 bytes (4.2 MB)
==================================================
downloaded 4.2 MB

* installing *source* package ‘rgdal’ ...
** using staged installation
configure: R_HOME: /Library/Frameworks/R.framework/Resources
configure: CC: clang -mmacosx-version-min=10.13
configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++11
configure: CFLAGS: -Wall -g -O2
configure: CPPFLAGS: -I/usr/local/include
configure: CXXFLAGS: -Wall -g -O2
configure: LDFLAGS: -L/usr/local/lib
configure: LDFLAGS: -L/usr/local/lib
configure: CXX11 is: clang++ -mmacosx-version-min=10.13, CXX11STD is: -std=gnu++11
configure: CXX is: clang++ -mmacosx-version-min=10.13 -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.5-19
checking for /usr/bin/svnversion... yes
svnversion: error: Failed to locate 'svnversion'.
svnversion: error: The subversion command line tools are no longer provided by Xcode.
configure: svn revision: 
configure: gdal-config set to /opt/local/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... cat: inst/SVN_VERSION: No such file or directory
yes
configure: GDAL: 3.2.0
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /opt/local/share/gdal/stateplane.csv readable... yes
configure: pkg-config proj not available
  set PKG_CONFIG_PATH to the directory containing proj.pc
configure: PROJ version not determined using pkg-config proj
configure: PROJ CPP flags:  -I/opt/local/include
configure: PROJ LIBS:  -lproj
checking PROJ header API:... yes
configure: API to be used as yet undetermined, searching ...
./configure: line 2509: pkg-config: command not found
configure: error: API to be used not found
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Users/blesht/Library/R/4.0/library/rgdal’

The downloaded source packages are in
    ‘/private/var/folders/l1/qvc9dqvn42b2y88cbyq_m3yw0000gn/T/RtmpsbrzxM/downloaded_packages’
Warning message:
In install.packages("rgdal", type = "source", repos = "http://R-Forge.R-project.org",  :
  installation of package ‘rgdal’ had non-zero exit status
Fleetboat
  • 189
  • 7
  • 1
    Have you tried installing the `type="binary"` instead of from "source"? – Dave2e Dec 21 '20 at 22:48
  • Thanks for the suggestion, Dave2e. That was the first thing I tried (seems like weeks ago), but the installation always has failed (tried many times) with a Timeout failure. I don't think that's the answer. – Fleetboat Dec 21 '20 at 23:28
  • If you are getting a timeout failure maybe try another repository. I am using R under Rstudio (on my Mac) using the default download repository and I was able to download the binary build of "rgdal" without issue. Also I generally avoid the source version in order to prevent the build errors you are seeing. Good luck. – Dave2e Dec 21 '20 at 23:36
  • Thanks again, Dave2e. No joy, I'm afraid. I've tried several repositories and the install fails the same way. I also tried installing from RStudio without success, getting the timeout error. I've never had a problem installing any other package. May I ask how you installed gdal and svn and which MacOS you're using? – Fleetboat Dec 28 '20 at 17:37
  • I recently had to reinstall rgdal, after upgrading to MacOS 11, on my intel based iMac (R ver 4.0.x, rgdal-1.5-18 and no svn). I installed the binary instead of the source in order to avoid the compile issues. It is a big file so if you have a firewall maybe and issue?? One potential option, go to https://cran.r-project.org, find the package (try this link: https://cran.r-project.org/bin/macosx/contrib/4.0/rgdal_1.5-18.tgz) and download the .tar file of binary version, once it is untarred/unzipped you could try dropping the folder into your R library folder. – Dave2e Dec 28 '20 at 23:16
  • I'll give that a try. At this point I'm tempted to delete everything and start over from scratch. Appreciate the help. – Fleetboat Dec 29 '20 at 15:44

1 Answers1

2

I was able to install the rgdal package after much trouble.

Mac OS X 10.15.7 (Catalina)

R version 4.1.1 (2021-08-10)

RStudio version 1.4.1717

  1. from inside of RStudio using the Tools/Install Packages menu, chose CRAN repository, and install "sf" package

  2. then do the same from CRAN repository to install "rgdal"

These steps installed packages:

sf 1.0-2

rgdal 1.5-23