【问题标题】:How to solve "Error: libudunits2.a not found" when installing "udunits2" in R 3.6.0 from Linux?从 Linux 在 R 3.6.0 中安装“udunits2”时如何解决“错误:找不到 libudunits2.a”?
【发布时间】:2020-04-15 16:48:06
【问题描述】:

我尝试使用以下方法在 Linux 中安装 udunits2(因为我需要 sf 包):

install.packages("/panfs/roc/groups/5/.../udunits2_0.13.tar.gz", repos=NULL, type ="source")

但我收到此错误消息:

(as ‘lib’ is unspecified)
* installing *source* package ‘udunits2’ ...
** package ‘udunits2’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... /panfs/roc/msisoft/gcc/8.1.0/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /panfs/roc/msisoft/gcc/8.1.0/bin/gcc accepts -g... yes
checking for /panfs/roc/msisoft/gcc/8.1.0/bin/gcc option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
...
checking for stdint.h... yes
checking for unistd.h... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... no
-----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.
ERROR: configuration failed for package ‘udunits2’
* removing ‘/panfs/roc/groups/5/.../R/x86_64-pc-linux-gnu-library/3.6/udunits2’
Warning message:
In install.packages("/panfs/roc/groups/5/.../udunits2_0.13.tar.gz",  :
  installation of package ‘/panfs/roc/groups/5/.../udunits2_0.13.tar.gz’ had non-zero exit status
>

然后我尝试安装:libudunits2-dev、libgdal-dev、libgeos-dev 和 libproj-dev。但其中任何一个都可用于 R 版本 3.6.0。

有人有建议吗?我尝试了很多事情都没有成功。非常感谢!

【问题讨论】:

  • 嗨。您是否已经尝试按照此处提供的安装所需库的说明:github.com/r-spatial/sf#linux
  • 非常感谢伊布塞特。这个链接很有帮助!

标签: linux sf


【解决方案1】:

你误解了 sf 的依赖。 SF 需要 GDAL 才能执行。在 Linux,特别是 Ubuntu 中,这需要安装 Ubuntu 软件包:libudunits2-dev、libgdal-dev、libgeos-dev 和 libproj-dev。

而 udunits2 是一个 R 包,它也依赖于 Ubuntu 的 libudunits2。 SF的安装不需要安装udunits2。

正如 ibusett 的评论链接中所述,您可以执行以下操作:

apt-get -y update && apt-get install -y  libudunits2-dev libgdal-dev libgeos-dev libproj-dev

或者:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev 

在 Ubuntu 的终端上,而不是在 R 的控制台上。

【讨论】:

    【解决方案2】:

    为了记录,如果您使用的是 conda,那就是问题所在。使用conda deactivate然后尝试安装包,对我来说解决它(当然我已经安装了artidata提到的包)

    【讨论】:

    • @AdrianaCastilloCastillo 如果解决了它,你能把它作为正确的答案吗?谢谢你!
    猜你喜欢
    • 2018-10-25
    • 2018-04-14
    • 2021-12-08
    • 1970-01-01
    • 2018-04-22
    • 1970-01-01
    • 2021-12-07
    • 2021-04-12
    • 1970-01-01
    相关资源
    最近更新 更多