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

僤鯓⒐⒋嵵緔 提交于 2021-01-28 06:44:42

问题


In trying to install the sf R package, I got the error message:

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

I then installed gdal 2.3.1 from conda and confirmed the version:

gdalinfo --version

GDAL 2.3.1, released 2018/06/22

But I still get the same error message.

SF on R 3.5 can't find correct version of gdal looks similar but their solution involved installing outside of conda. I'm on Ubuntu.

How can I get sf to recognize the correct version of gdal I have installed?

Edit: sessionInfo() in R shows:

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

I had another issue when installing R from conda

Edit: When installing R from conda via conda install -c r r, I got this error:

-----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.

This was still the case after installing udunits and udunits2 from conda:

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

回答1:


The following worked for me, though I ran it on Centos 6 rather than Ubuntu 16.04.

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

.

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



回答2:


Errors are caused by non-conda package installations. From a clean environment, the sf package can be installed directly from conda:

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

Or from a clean environment:

conda install -c conda-forge r-sf



回答3:


after having similar conflict issues in conda on OSX with r-sf and r-gdal i was able to get them installed with a fresh environment by installing them both immediately after initiating the new env

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


来源:https://stackoverflow.com/questions/51367237/sf-r-package-is-not-compatible-with-gdal-versions-below-2-0-0-after-installing

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