Trouble installing rgdal

install rgdal mac
installation of package ‘rgdal’ had non-zero exit status
rgdal won t install
error: compilation failed for package rgdal
yum install rgdal
configure: error: gdal-config not found or not executable rgdal
rgdal older version
install rgdal from github

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!

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

Cannot install package rgdal - General, When I tried to install the rgdal package, I got the error: configure: error: gdal- config not found or not executable. ERROR: configuration failed for package ' rgdal'� To fix this and other possible maladies with your rgdal installation, use the following R command to install rgdal: > install.packages('rgdal', type = "source", configure.args=c('--with-proj-include=/usr/local/include','--with-proj-lib=/usr/local/lib'))

Quick note building on previous answer by @Stophface that might be useful to someone:

I did all steps listed above, but the rgdal installation in Terminal still gave me the error of configure: error: proj_api.h not found in standard or given locations. Yet (and without knowing exactly why), I managed to install it from R.app using pretty much the same specifications:

> install.packages('rgdal', type = "source", configure.args=c(
     '--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 thanks again for your answer!

Error in library(rgdal) : there is no package called 'rgdal, did install.packages("rgdal") succeeded ? or were you having an error message at installation ? Know that rgdal on needs a dependency when� Installing package into ‘/home/kocesat/R/x86_64-pc-linux-gnu-library/3.2’(as ‘lib’ is unspecified)Warning in install.packages :package ‘rgdal’ is not available (for R version 3.2.3) Then I try to install libgdal1-dev , libproj-dev as the following. $ sudo apt-get install libgdal1-dev libproj-dev.

I had the same error Running R 3.4.0 on macOS Sierra (10.12). So I used homebrew to install gdal, then rgdal installed as per usual in R

in Terminal

brew update
brew install gdal

in R

install.packages("rgdal")

devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.0 (2017-04-21)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.0.143)           
 language (EN)                        
 collate  en_AU.UTF-8                 
 tz       Australia/Melbourne         
 date     2017-04-24                  

Packages --------------------------------------------------------------------------------------------------------------------------------------------------
 package  * version date       source        
 devtools   1.12.0  2016-12-05 CRAN (R 3.4.0)
 digest     0.6.12  2017-01-27 CRAN (R 3.4.0)
 lattice    0.20-35 2017-03-25 CRAN (R 3.4.0)
 memoise    1.1.0   2017-04-21 CRAN (R 3.4.0)
 rgdal    * 1.2-6   2017-04-06 CRAN (R 3.4.0)
 sp       * 1.2-4   2016-12-22 CRAN (R 3.4.0)
 withr      1.0.2   2016-06-20 CRAN (R 3.4.0)

How to install the rgdal R package � GitHub, installing source package 'rgdal' configure: error: gdal-config not found or not executable. The packages libgdal-dev and libproj-dev are required: sudo apt-get � Subject: Re: [R-sig-Geo] problem for installing "rgdal" package in r To: robin50488@hotmail.com CC: r-sig-geo@r-project.org This question has been asked here before. Which distribution are you using? If you are using debian or ubuntu the admin should install libgdal1-dev for building gdal. I also recommend installing r-base-dev if it is not yet

I installed it via conda on my Mac (OS X 10.10.5). The installation was simple. If you're new to conda, check this http://conda.pydata.org/docs/r-with-conda.html

conda install gdal
gdalinfo --version
# GDAL 2.1.0, released 2016/04/25

R Package installation:

install.packages('rgdal', type = "source", configure.args=c(
    '--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'))

install.packages('rgeos', type = "source", configure.args=c(
    '--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'))

install.packages('maptools', dependencies=TRUE)

Installing RGDAL and RGEOS in R on Linux, ERROR: configuration failed for package 'rgdal' You experience these errors because R in Linux installs the packages from source (rather than a� RGDAL The RGDAL package is used by R and RStudio to plot maps. Under Linux you may encounter one or two errors when trying to install the package: Error: gdal-config not found. The gdal-config script distributed with GDAL could not be found. Or: configure: error: proj_api.h not found in standard or given locations.

Installing rgeos and rgdal on Mac OS X Mavericks, T-LoCoH - Installing rgeos and rgdal on a Mac Problems installing geos? But , if you get an error message, the next thing to try is to install rgeos from the� rgdal: Bindings for the 'Geospatial' Data Abstraction Library. Provides bindings to the 'Geospatial' Data Abstraction Library ('GDAL') (>= 1.11.4) and access to projection/transformation operations from the 'PROJ' library. Use is made of classes defined in the 'sp' package.

CRAN, The 'GDAL' and 'PROJ' libraries are external to the package, and, when installing the package from source, must be correctly installed first; it is� R contributed package "rgdal" As from release 0.3-5, rgdal depends on contributed package sp from CRAN, and reads and writes supported rasters with spatial references if available to and from sp classes. From this release, it also supports reading OGR vector data with spatial references if available into sp classes.

rgdal installation error: How to set GDAL_DATA directory , Luckily, I was able to figure this out. It is necessary to set the GDAL_DATA directory in the same terminal session, open R, then install rgdal . If you are unable to install packages in RStudio, some common problems are outlined below: Are you able to install packages in R? If you're having issues, we recommend trying to install packages in R (outside of RStudio) and see if you're able to do that. If not, please check the possible solutions below. Is the package available?

Comments
  • devtools::session_info() would be helpful to see the whole R+system config. I use Homebrew for the supporting library installs and have no trouble, but you may be able to add export PATH="/Library/Frameworks/GDAL.framework/Programs:$PATH" (that's the path for gdal-config using the KC frameworks IIRC) to your profile and restart R/RStudio and try the install again.
  • @Phil added the info
  • If you type gdal-config in the terminal (not the R console) does it produce an error, or print something?
  • @hrbrmstr that did not do the trick
  • @Phil bash: gdal-config: command not found
  • @Phil Thanks, maybe someone will find it useful at one point :)
  • Thanks for this. Could not get it to work. Eventually got gdal installed using home brew in one line and the was able to install rgdal with no problem. This on OsX 10.11.3 R3.2.3
  • Many thanks for this. Several useful tips. Needed to modify slightly to get the rgdal file name correct. Didn't manage to get rgeos R pkg installed with this.
  • Thanks, it works! However, I would like to know why this problem arises.
  • @IrbinB. Well, it's because the software does not know where to look for certain files. Therefore, you have to manually tell it where to look for them.
  • Bravo. Worked for me when the KingChaos solution did not. KingChaos had always succeeded before.
  • Thank you for this answer! I was manually downloading files not sure what was happening. I'm beyond thankful for the folks at Homebrew. For anyone else who this might help, I had to run the following commands in Terminal: $ brew update, followed by $ brew install gdal. Then I installed rgdal in R install.packages( pkgs = "https://cran.r-project.org/src/contrib/rgdal_1.2-18.tar.gz", repos = NULL, type = "source").