【问题标题】:Problem with R package installation: sf; system library not foundR包安装问题:sf;未找到系统库
【发布时间】:2019-02-24 20:53:08
【问题描述】:

我正在尝试安装 R 包 sf。它提到了系统依赖 GDAL、GEOS 和 PROJ.4。我已经使用
$sudo apt-get install libgdal-dev libgeos-dev libproj-dev proj-bin
安装了所有这些 然而 sf 仍然抱怨它缺少(来自?)库:

$sudo R CMD INSTALL sf_0.6-3.tar.gz
[...]
configure: pkg-config proj exists, will use it
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
configure: PROJ: 4.9.2
checking for pj_init_plus in -lproj... no
configure: error: libproj not found in standard or given locations.
ERROR: configuration failed for package ‘sf’  

在 R 中使用 install.packages("sf") 命令也是如此。我在 Ubuntu 16.04 系统上使用 R 版本 3.5.0,我设法在另一台 R 版本 3.4.3 的计算机上安装了该软件包,但不知道我做了什么不同的事情来让它发挥作用。 apt 和pkg-config --modversion proj 都说版本高于需要的版本(4.9.2),我试图找到一些可以帮助我使用 pkg-config 或在互联网上解决问题的信息,但找不到任何东西。我确实在 /usr/include/proj_api.h 中找到了以下行(使用 sudo apt-file search proj_api.h 找到):
projPJ pj_init_plus(const char *);
其中提到未找到支票中的东西,但我不明白它与此有什么关系。

请注意,我确实安装了两个版本的 R,我在计算机上也安装了 3.2.3 版本。这可能是问题的根源吗? (我确定,我安装 sf 包的版本是 3.5)

编辑

我找到了另一个具有 libproj 依赖项的 R 包 (proj4),并尝试安装该包。虽然它确实停止了相同的错误,但它给出了一条更长的消息:

>install.packages("proj4")
[...]
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
checking for pj_init_plus in -lproj... no
configure: error: libproj and/or proj_api.h not found in standard search locations.

*** Install PROJ.4 and if necessary set PKG_CPPFLAGS/PKG_LIBS accordingly.
ERROR: configuration failed for package ‘proj4’

PKG_CPPFLAGS/PKG_LIBS 变量?在 R 中找不到,echo $PKG_LIBS 也没有显示。有没有办法可以设置这些以便安装软件包?

感谢您提供有关导致此问题的任何提示或提示。

彼得

【问题讨论】:

  • 您找到解决方案了吗?
  • 遗憾的是没有。我的解决方案是“使用不同的计算机”。

标签: r sf proj


【解决方案1】:

我认为你可能正在使用旧版本的 libgdal-dev 而你

以下问题可能是您遇到的问题

Rgdal installation failed on 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

【讨论】:

  • 谢谢。这实际上是问题所在,我在这个问题之前就遇到过。然后我添加了稳定的 ubuntigis repo 并在 gdal v 2.1.3 上。现在,另外添加不稳定的 repo 并升级到 v 2.2 并没有帮助解决上述错误。
猜你喜欢
  • 2020-12-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-16
  • 2017-12-20
相关资源
最近更新 更多