【问题标题】:ggplot2 fails to install on R 3.0.2ggplot2 无法在 R 3.0.2 上安装
【发布时间】:2015-06-04 06:39:29
【问题描述】:

我无法在 Ubuntu 上的 R 3.0.2 中安装 ggplot2。

当我跑步时

install.packages('ggplot2',dependencies = TRUE)

我收到以下错误。

 > install.packages('ggplot2',dependencies = TRUE)
Installing package into ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependencies ‘plyr’, ‘testthat’ are not available
also installing the dependencies ‘reshape2’, ‘scales’, ‘Hmisc’

trying URL 'http://cran.rstudio.com/src/contrib/reshape2_1.4.1.tar.gz'
Content type 'application/x-gzip' length 34693 bytes (33 Kb)
opened URL
==================================================
downloaded 33 Kb

trying URL 'http://cran.rstudio.com/src/contrib/scales_0.2.4.tar.gz'
Content type 'application/x-gzip' length 40093 bytes (39 Kb)
opened URL
==================================================
downloaded 39 Kb

trying URL 'http://cran.rstudio.com/src/contrib/Hmisc_3.16-0.tar.gz'
Content type 'application/x-gzip' length 629536 bytes (614 Kb)
opened URL
==================================================
downloaded 614 Kb

trying URL 'http://cran.rstudio.com/src/contrib/ggplot2_1.0.1.tar.gz'
Content type 'application/x-gzip' length 2351203 bytes (2.2 Mb)
opened URL
==================================================
downloaded 2.2 Mb

ERROR: dependency ‘plyr’ is not available for package ‘reshape2’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/reshape2’
    Warning in install.packages :
      installation of package ‘reshape2’ had non-zero exit status
    ERROR: dependency ‘plyr’ is not available for package ‘scales’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/scales’
    Warning in install.packages :
      installation of package ‘scales’ had non-zero exit status
    ERROR: dependencies ‘plyr’, ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/ggplot2’
    Warning in install.packages :
      installation of package ‘ggplot2’ had non-zero exit status
    ERROR: dependencies ‘ggplot2’, ‘scales’ are not available for package ‘Hmisc’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/Hmisc’
    Warning in install.packages :
      installation of package ‘Hmisc’ had non-zero exit status

我也试过了

install.packages(c('reshape2','scales'))

得到plyr不可用的错误。

我还升级了 Ubuntu 并重新安装了最新版本的 R 并使用 update.packages(checkBuilt=TRUE) 更新了软件包。 但是,没有任何效果。我能做什么?

【问题讨论】:

  • 您是否安装了包plyr?另外,如果不是R版本的错别字,请考虑升级R(当前版本为3.2.0)。
  • 3.0.2 已经过时了。如果你真的想使用这个版本,你将不得不手动编译所有依赖项(去每个包存档并下载与 3.0.2 兼容的版本)。
  • 谢谢。有效。出于某种原因, sudo apt-get install r-base 正在安装 3.0.2。我更新了这里提到的源 - askubuntu.com/questions/218708/… 并且它有效。

标签: r ggplot2 plyr


【解决方案1】:

如果您不需要最新版本,可以使用以下方式安装 Ubuntu 分发的打包版本:

sudo apt-get install r-cran-ggplot2

【讨论】:

    【解决方案2】:

    我通过输入以下命令解决了这个问题:

    $ sudo apt-get install r-cran-plyr
    $ sudo apt-get install r-cran-reshape2
    

    【讨论】:

    • r-cran-plyrr-cran-reshape2 都是 r-cran-ggplot2 的依赖项,因此使用 sudo apt-get install r-cran-ggplot2 应该可以解决所有问题(假设不需要最新版本)。
    【解决方案3】:

    您应该将您的 R 版本 (r-base) 更新到最新版本。 命令行如:

    $ sudo apt-get update
    $ sudo apt-get install r-base
    

    更新对我不起作用。

    【讨论】:

      【解决方案4】:

      apt-get 跟踪在 /etc/apt/sources.list 中查找包的 repos。大多数人的 sources.list 中定义的默认集不包括 CRAN 镜像。对于 Ubuntu 用户,您可以将以下行添加到 /etc/apt/sources.list:

      deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <linux ver>/
      

      我使用 'trusty' Ubuntu 版本并且更喜欢 berkley cran 镜像,所以我的线路如下所示:

      deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu trusty/
      

      如果您需要找出您的 Ubuntu 版本,请尝试运行:

      lsb_release -a
      

      现在 apt-get 可以为您与 CRAN 镜像交互。享受吧!

      【讨论】:

        【解决方案5】:

        从 [http://cran.es.r-project.org/bin/linux/ubuntu/trusty/] 下载最新版本的 r-base (3.2.2) 使用 Ubuntu 软件中心打开并安装。 这会将您已安装的版本更新到最新版本。然后尝试再次安装 ggplot2 软件包。它像魔术一样对我有用。 祝你好运!!

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-08-03
          • 2020-02-29
          • 2014-10-03
          • 2015-06-02
          • 1970-01-01
          相关资源
          最近更新 更多