Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: error: geos-config not found or not executable. ERROR: configuration failed for package ‘rgeos’ problem while installing sf package on MacOS #1797

Closed
muhammetozkaraca opened this issue Sep 18, 2021 · 1 comment

Comments

@muhammetozkaraca
Copy link

I tried a couple of hours to install sf package (on MacOs) by using most of the solutions I encountered on the web but still, it did not work. Let me show, what I did and then what the problem is step by step.

First, I tried the normal thing install.packages("sf") which resulted in the following error.

URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/sf_1.0-2.tgz' deneniyor
Content type 'application/x-gzip' length 93022013 bytes (88.7 MB)
====================================
downloaded 65.3 MB

Warning in install.packages :
  downloaded length 68510897 != reported length 93022013
Warning in install.packages :
  URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/sf_1.0-2.tgz': Timeout of 60 seconds was reached
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  download from 'https://cran.rstudio.com/bin/macosx/contrib/4.1/sf_1.0-2.tgz' failed
Warning in install.packages :
  download of package ‘sf’ failed

Following that, I tried to comply with the instructions in this website https://github.com/r-spatial/sf. To this end, I first installed home brew and then rendered these two codes on the MacOS terminal.

brew install pkg-config 
brew install gdal

And, finally, in line with the website's suggestion, I run this code to install rgdal package to get sf installed.

install.packages("rgdal", configure.args = c("--with-proj-lib=/usr/local/lib/", "--with-proj-include=/usr/local/include/"))

However, it came with the following error.

  There is a binary version available but the source version is later:
      binary source needs_compilation
rgdal 1.5-26 1.5-27              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘rgdal’

URL 'https://cran.rstudio.com/src/contrib/rgdal_1.5-27.tar.gz' deneniyor
Content type 'application/x-gzip' length 4391149 bytes (4.2 MB)
==================================================
downloaded 4.2 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
** 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++14
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-27
checking for /usr/bin/svnversion... no
configure: svn revision: 1148
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/tc/g15hmz9s0hg1nxmh7_4mw9lm0000gn/T/RtmplfPV9h/downloaded_packages’

As suggested in this website https://github.com/r-spatial/sf, I alternatively tried the solutions in #1536 (comment).

Yet, in the part 2, when I run this code chunk,

install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source")
install.packages("rgdal", repos="http://R-Forge.R-project.org", type="source")
library(devtools)
install_github("r-spatial/sf", configure.args = "--with-proj-lib=/usr/local/lib/")

A similar problem emerged for all these codes. For instance, for the first one, the error was;

URL 'http://R-Forge.R-project.org/src/contrib/rgeos_0.5-8.tar.gz' deneniyor
Content type 'application/x-gzip' length 276303 bytes (269 KB)
==================================================
downloaded 269 KB

* installing *source* package ‘rgeos’ ...
** using staged installation
configure: CC: clang -mmacosx-version-min=10.13
configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++14
configure: rgeos: 0.5-7
checking for /usr/bin/svnversion... no
cat: inst/SVN_VERSION: No such file or directory
configure: svn revision: 
checking for geos-config... no
no
configure: error: geos-config not found or not executable.
ERROR: configuration failed for package ‘rgeos’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/rgeos’
Warning in install.packages :
  installation of package ‘rgeos’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/tc/g15hmz9s0hg1nxmh7_4mw9lm0000gn/T/RtmplfPV9h/downloaded_packages’

And lastly, I followed the instructions to solve this problem on this website; https://stackoverflow.com/questions/44973639/trouble-installing-sf-due-to-gdal

First: gdalinfo --version code resulted in GDAL 3.3.2, released 2021/09/01
Second, I did brew unlink gdal, yet when I run brew link --force gdal2, it did not work. (I am a new user so I assumed it might be because of different versions but when I tried brew link --force gdal3.3.2, it gave me the error Error: No such keg: /opt/homebrew/Cellar/gdal3.3.2.

So, if you can help me how to install sf on MacOS, I will be very glad for that.

@muhammetozkaraca muhammetozkaraca changed the title configure: error: geos-config not found or not executable. ERROR: configuration failed for package ‘rgeos’ problem while installing sf package configure: error: geos-config not found or not executable. ERROR: configuration failed for package ‘rgeos’ problem while installing sf package on MacOS Sep 18, 2021
@muhammetozkaraca
Copy link
Author

muhammetozkaraca commented Sep 18, 2021

Based upon a solution that I received in Stack overflow, the problem is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant