在ubuntu 16.04上,Rgdal安装失败

时间:2017-03-23 16:31:36

标签: r linux rstudio ubuntu-16.04 rgdal

我一直在尝试在ubuntu 16.04上从RStudio版本1.0.44安装rgdal然后我收到 gdal-config not found 错误。我通过安装libgdal1-dev& libproj包,但现在我收到以下错误。有人帮我解决了这个问题。

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
unable to load shared object '/home/hetch/R/x86_64-pc-linux-gnu-library/3.3/rgdal/libs/rgdal.so':
/usr/lib/x86_64-linux-gnu/libgeos_c.so.1: undefined symbol:_ZN4geos4geom18IntersectionMatrixC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/hetch/R/x86_64-pc-linux-gnu-library/3.3/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status

2 个答案:

答案 0 :(得分:5)

我在尝试安装rgdal包时遇到了一些问题,但最终我成功了。 我的问题是gdal>需要2.0,默认情况下不附带ubuntu 16.04,因此需要额外的软件包。

我最终安装了以下软件包:

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

此外,r> 3.3也是必需的,所以我最终更新了ubuntu的默认r-base安装,如下所示:

sudo add-apt-repository 'deb https://cran.rediris.es/bin/linux/ubuntu xenial/'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt update

希望它也适合你。

答案 1 :(得分:0)

对于Rh6,您只需要安装:

yum install proj-devel-4.8.0-4.1.x86_64.rpm

N.B:在我的情况下,我的服务器没有连接到互联网,所以我将包从repo下载到我的本地机器,然后将其复制到我的服务器。