in...">

Problem setting "sf" due to "gdal"

I can not install the "sf" package on R. It seems the problem is with gdal. I don’t know how to solve it.

> install.packages("sf") There is a binary version available but the source version is later: binary source needs_compilation sf 0.4-3 0.5-1 TRUE Do you want to install from sources the package which needs compilation? y/n: y installing the source package 'sf' trying URL 'https://cran.rstudio.com/src/contrib/sf_0.5-1.tar.gz' Content type 'application/x-gzip' length 4073881 bytes (3.9 MB) ================================================== downloaded 3.9 MB * installing *source* package 'sf' ... ** package 'sf' successfully unpacked and MD5 sums checked configure: CC: clang configure: CXX: clang++ checking for gdal-config... no no configure: error: gdal-config not found or not executable. ERROR: configuration failed for package 'sf' * removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf' Warning in install.packages : installation of package 'sf' had non-zero exit status The downloaded source packages are in '/private/var/folders/1m/w_zt5ygd26n_87h41qf574wc0000gn/T/RtmpNlYbwT/downloaded_packages' 

Why is it said that the download failed, and then say that the source packages are downloaded. What gives?

+5
source share
1 answer

Before a similar problem, I performed the following steps:

  • In Terminal : gdalinfo --version to check which version of gdal you have. Mine was GDAL 2.2.0, released 2017/04/28 after brew update and brew upgrade
  • From here: https://github.com/r-spatial/sf , instructions for macOS, since I already have gdal installed, I used only brew unlink gdal and then brew link --force gdal2
  • I reinstalled rgdal to R: install.packages("rgdal", repos = "http://cran.us.r-project.org", type = "source") , and I confirmed that it was compiled with configure : GDAL: 2.2.0
  • Finally, install.packages("sf") and it must be compiled: binary source needs_compilation sf 0.5-3 TRUE
  • Again, I confirmed configure: GDAL: 2.2.0 and checking the version of GDAL> = 2.0.0 ... yes

After that I have a new version installed: library (SF) Communication with GEOS 3.6.2, GDAL 2.2.0, proj.4 4.9.3

I hope this can be for you too.

+7
source

Source: https://habr.com/ru/post/1269608/


All Articles