从 conda 安装 gdal 2.3 后 sf R 包 "is not compatible with GDAL versions below 2.0.0"

sf R package "is not compatible with GDAL versions below 2.0.0" after installing gdal 2.3 from conda

在尝试安装 sf R 包时,我收到错误消息:

checking GDAL version >= 2.0.0... no
configure: error: sf is not compatible with GDAL versions below 2.0.0

然后我安装了gdal 2.3.1 from conda并确认了版本:

gdalinfo --version

GDAL 2.3.1, released 2018/06/22

但我仍然收到相同的错误消息。

看起来很相似,但他们的解决方案涉及在 conda 外部安装。我在 Ubuntu.

如何让 sf 识别我安装的 gdal 的正确版本?

编辑:sessionInfo()R 显示:

R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
[1] C

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

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1

我在从 conda 安装 R 时遇到了另一个问题

编辑:通过 conda install -c r r 从 conda 安装 R 时,出现此错误:

-----Error: libudunits2.a not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.

从 conda 安装 udunitsudunits2 后仍然如此:

conda install -c conda-forge udunits
conda install -c conda-forge udunits2

以下对我有用,尽管我 运行 它是在 Centos 6 而不是 Ubuntu 16.04.

conda create -n rsf r-udunits2 geos gdal proj4
source activate rsf
R

.

install.packages("sf")
library("sf")

错误是由非 conda 软件包安装引起的。在干净的环境中,可以安装 sfdirectly from conda:

conda create -n rsf -c conda-forge r-sf
source activate rsf

或来自干净的环境:

conda install -c conda-forge r-sf

在 OSX 与 r-sf 和 r-gdal 上的 conda 中出现类似的冲突问题后,我能够通过在启动新环境后立即安装它们来在新环境中安装它们环境

conda install -c conda-forge r-essentials geos r-rgeos r-rgdal r-sf