Ubuntu 16.04 R Installation: configure: gdal-config not found or not executable

岁酱吖の 提交于 2019-12-19 06:58:23

问题


System info:

Ubuntu 16.04
64 bit

I'm trying to install rgdal_1.2-16.tar.gz for a research project. I looked here and did

sudo apt-get install libgdal1i

R CMD INSTALL rgdal_1.2-16.tar.gz 
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.2-16
checking for /usr/bin/svnversion... no
configure: svn revision: 701
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/local/lib/R/site-library/rgdal’

So then I tried opening R:

R
> install.packages('/home/n/Downloads/rgdal_1.2-16.tar.gz', repos = NULL, type="source")

but got

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.2-16
checking for /usr/bin/svnversion... no
configure: svn revision: 701
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/local/lib/R/site-library/rgdal’
Warning message:
In install.packages("/home/n/Downloads/rgdal_1.2-16.tar.gz", repos = NULL,  :
  installation of package ‘/home/n/Downloads/rgdal_1.2-16.tar.gz’ had non-zero exit status

Please point out where I am missing something


More info that may help:

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] sp_1.2-7

loaded via a namespace (and not attached):
[1] compiler_3.4.3  grid_3.4.3      lattice_0.20-35

===============================================

Edit:

===============================================

I ran

sudo apt-get install libgdal-dev

and reran

> install.packages('/home/n/Downloads/rgdal_1.2-16.tar.gz', repos = NULL, type="source")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.2-16
checking for /usr/bin/svnversion... no
configure: svn revision: 701
checking for gdal-config... /usr/bin//gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.11.3
checking GDAL version >= 1.6.3... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/1.11/pcs.csv readable... yes
configure: -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/include/gdal
checking proj_api.h presence and usability... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/local/lib/R/site-library/rgdal’
Warning message:
In install.packages("/home/n/Downloads/rgdal_1.2-16.tar.gz", repos = NULL,  :
  installation of package ‘/home/n/Downloads/rgdal_1.2-16.tar.gz’ had non-zero exit status

回答1:


You have to install gdal, proj & geos on your Linux system.

 sudo apt-get install libgdal1-dev gdal-bin libproj-dev proj-data proj-bin libgeos-dev

To compile yourself, see this script

Edit 1: add PasteBin link for backup

Edit 2: to install packages automatically from both CRAN and Bioconductor, use p_load from the pacman package

Edit 3: For Ubuntu 18.04 Bionic or Mint 19 Tara

 sudo apt-get install libgdal-dev gdal-bin libproj-dev proj-data proj-bin libgeos-dev


来源:https://stackoverflow.com/questions/49180812/ubuntu-16-04-r-installation-configure-gdal-config-not-found-or-not-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!