【问题标题】:Installing "choroplethr" in Ubuntu在 Ubuntu 中安装“choroplethr”
【发布时间】:2019-04-25 17:37:40
【问题描述】:

我正在尝试安装“choroplethr”。

我已阅读以下相关错误:

他们的建议是安装我已经安装的东西。我在标准位置安装了 libudunits2,其中:

$ sudo apt-get install libudunits2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libudunits2-dev is already the newest version (2.2.26-1).

我可以看到标题:

$ ll /usr/include/ | grep unit
-rw-r--r--   1 root root  39998 Jan  5  2018 udunits2.h
-rw-r--r--   1 root root   5195 Jan  5  2018 udunits.h

但是,在安装时,我收到此错误:

$ R
R version 3.5.1 (2018-07-02) -- "Feather Spray"

> install.package("choroplethr", dep=T)
...
configure: error: in `/tmp/RtmpWC06JV/R.INSTALL7cbb4928db67/units':
configure: error: 
--------------------------------------------------------------------------------
  Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  if the library was not found, and/or:
    --configure-args='--with-udunits2-include=/usr/include/udunits2'
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------

我已经完成了这些设置,但是

install.packages("udunits2", configure.args = '--with-udunits2-include=/usr/include/udunits2')

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

我错过了什么?这个包只有 OSX 吗?

【问题讨论】:

  • 你使用哪个 Ubuntu 版本?
  • Ubuntu 版本 18.04

标签: r ggplot2 tidyverse rgdal choroplethr


【解决方案1】:

对于带有 R 3.5 的 Ubuntu,您可以使用在 CRAN 上为您提供 R Ubuntu 软件包的同一个人提供的 c2d4u3.5 PPA,c.f. https://cran.r-project.org/bin/linux/ubuntu/README.htmlhttp://dirk.eddelbuettel.com/blog/2017/12/22/:

sudo add-apt-repository ppa:marutter/c2d4u3.5
sudo apt-get update

之后,您可以为大多数 CRAN 包安装二进制包:

sudo apt-get install r-cran-choroplethr

这应该适用于 CRAN 任务视图中提到的所有包。

除此之外,我尝试使用 docker 重现您的安装问题:

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
 && apt-get install --yes --no-install-recommends gnupg ca-certificates \
 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
 && echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/" >> /etc/apt/sources.list \
 && apt-get update \
 && apt-get install  --yes --no-install-recommends r-base-dev libudunits2-dev \
 && Rscript -e 'install.packages(c("units", "udunits2"))'

但是,图像构建没有问题。

【讨论】:

  • 谢谢,拉尔夫。有没有使用常规R安装界面的安装方案?我犹豫是否授权额外的回购。这里发生了什么需要这个第三方 ppa?
  • @Mittenchops 正常安装应该可以工作(请参阅我更新的答案中的 docker 文件)。使用这个 PPA 更方便,从我的角度来看,它是值得信赖的。
猜你喜欢
  • 2014-02-22
  • 2019-03-05
  • 2015-10-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多