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
1.0k views
in Technique[技术] by (71.8m points)

r - trouble in installing rgdal on ubuntu 16.04

I have been trying to install rgdal on R 3.4.2 (RStudio 1.1.383) and ubuntu 16.04 but it always end with a problem.

I have followed many recommendations like manually installing the dependencies like libproj-dev or my last try by using homebrew.

I was able to install gdal 1.11.3 but it's not sufficient.

Here is the output when I write

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

Installing package into ‘/home/tupac/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
essai de l'URL 'https://cran.rstudio.com/src/contrib/rgdal_1.2-15.tar.gz'
Content type 'application/x-gzip' length 1648779 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ correctement décompressé et sommes MD5 vérifiées
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.2-15
checking for /usr/bin/svnversion... no
configure: svn revision: 691
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/local/include 
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 ‘/home/tupac/R/x86_64-pc-linux-gnu-library/3.4/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The error "proj_api.h not found" has also been found in the same post but the solution given does not work in my case while it seems to work for many other users.

thank you for helping me in fixing this problem.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

I have finally been able to find a solution.

I followed the answer of this post

The miracle code is

sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install gdal-bin python-gdal python3-gdal libgdal1-dev

thank you for your help


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

...