Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
452 views
in Technique[技术] by (71.8m points)

r - Trouble installing rgdal

I want to install rgdal for "R version 3.2.3 (2015-12-10)". I downloaded and installed

  • GDAL 1.11 Complete
  • PROJ framework v4.9.2-2
  • GEOS framework v3.5.0-1

from KyngChaos

Then in RStudio I typed install.packages("rgdal") which gave me this:

> .... 
> 
> configure: CC: clang configure: CXX: clang++ configure: rgdal:
> 1.1-1 checking for /usr/bin/svnversion... yes configure: svn revision: 
> 572 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/3.2/Resources/library/rgdal’
> Warning in install.packages :   installation of package ‘rgdal’ had
> non-zero exit status

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] de_AT.UTF-8/de_AT.UTF-8/de_AT.UTF-8/C/de_AT.UTF-8/de_AT.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.3

I also tried in the terminal

R CMD INSTALL rgdal_1.1-1.tar --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config
 --with-proj-include=/Library/Frameworks/PROJ.framework/Headers
 --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

and

sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar

No luck!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Finally solved it.

Here is how I've done it! OS X 10.10.5 R 3.2.3 GDAL 1.1

  1. Download and install the GDAL Complete Framework from here
  2. Tell your OS X where to find the gdal-config file by typing this in you shell echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile and then source ~/.bash_profile
  3. Check if your GDAL is working fine by typing in the bash gdalinfo --version. That should come back with something like GDAL 1.11.3, released 2015/09/16.
  4. For most people, starting R and typing install.packages("rgdal") works (if you've done step 1-3). However, that was not the case for me. So, proceed with 5 if you're still having troubles.
  5. Go to the GDAL website and download the .tar file.
  6. In the shell, try this: sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar. That still gave me an error: configure: error: proj_api.h not found in standard or given locations. ERROR: configuration failed for package ‘rgdal’
  7. So, you again need to tell where to find that one. Try:
R CMD INSTALL rgdal_1.1-1.tar --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config
 --with-proj-include=/Library/Frameworks/PROJ.framework/Headers
 --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

That should work. Try by starting R and type library(rgdal) in the R console.

Note: With rgoes I experienced similar problems. This helped me. Try:

R CMD INSTALL rgeos_0.3-15.tar --configure-args='--with-geos-config=/Library/Frameworks/GEOS.framework/unix/bin/geos-config
--with-proj-include=/Library/Frameworks/PROJ.framework/Headers
--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

For pointing to the config file. It's here /Library/Frameworks/GEOS.framework/unix/bin/geos-config


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...