【问题标题】:Can't install package reshape2 for R 2.15.3 on Ubuntu 12.04.4无法在 Ubuntu 12.04.4 上为 R 2.15.3 安装包 reshape2
【发布时间】:2014-03-15 02:05:33
【问题描述】:

我在 Ubuntu 12.04.4 LTS 上安装 R 2.15.3 的 reshape2 包时遇到问题。我决定不升级到 R 3.x,因为我使用的许多软件包尚未升级以支持新版本。

当我尝试在 Ubuntu 12.04.4 LTS 上使用 R 2.15.3 安装 reshape2 时,我得到以下信息。

> install.packages("reshape2")                                                                                      
Installing package(s) into â/usr/local/lib/R/site-libraryâ
(as âlibâ is unspecified)
Warning in install.packages("reshape2") :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead?  (y/n) y
Would you like to create a personal library
~/R/x86_64-pc-linux-gnu-library/2.15
to install packages into?  (y/n) y

Warning: dependency âRcppâ is not available
also installing the dependencies âplyrâ, âstringrâ

trying URL 'http://cran.cs.wwu.edu/src/contrib/plyr_1.8.1.tar.gz'
Content type 'application/x-gzip' length 393233 bytes (384 Kb)
opened URL
==================================================
downloaded 384 Kb

trying URL 'http://cran.cs.wwu.edu/src/contrib/stringr_0.6.2.tar.gz'
Content type 'application/x-gzip' length 20636 bytes (20 Kb)
opened URL
==================================================
downloaded 20 Kb

trying URL 'http://cran.cs.wwu.edu/src/contrib/reshape2_1.2.2.tar.gz'
Content type 'application/x-gzip' length 27220 bytes (26 Kb)
opened URL
==================================================
downloaded 26 Kb

ERROR: dependency âRcppâ is not available for package âplyrâ
* removing â/home/ubuntu/R/x86_64-pc-linux-gnu-library/2.15/plyrâ
* installing *source* package âstringrâ ...
** package âstringrâ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (stringr)
ERROR: dependency âplyrâ is not available for package âreshape2â
* removing â/home/ubuntu/R/x86_64-pc-linux-gnu-library/2.15/reshape2â

The downloaded source packages are in
        â/tmp/RtmpxP5OIc/downloaded_packagesâ
Warning messages:
1: In install.packages("reshape2") :
  installation of package âplyrâ had non-zero exit status
2: In install.packages("reshape2") :
  installation of package âreshape2â had non-zero exit status
> 

然后我尝试安装缺少的 Rcpp,但收到错误消息:

Warning message:
package âRcppâ is not available (for R version 2.15.3) 

我又搜索了一些,发现 Rcpp 现在需要 R 版本 3.x,但有一个向后兼容的 RcppClassic 版本。

尝试安装 RcppClassic 时,我得到:

Installing package(s) into â/home/ubuntu/R/x86_64-pc-linux-gnu-library/2.15â
(as âlibâ is unspecified)
Warning: dependency âRcppâ is not available
trying URL 'http://cran.cs.wwu.edu/src/contrib/RcppClassic_0.9.5.tar.gz'
Content type 'application/x-gzip' length 185057 bytes (180 Kb)
opened URL
==================================================
downloaded 180 Kb

ERROR: dependency âRcppâ is not available for package âRcppClassicâ
* removing â/home/ubuntu/R/x86_64-pc-linux-gnu-library/2.15/RcppClassicâ

The downloaded source packages are in
        â/tmp/RtmpxP5OIc/downloaded_packagesâ
Warning message:
In install.packages("RcppClassic") :
  installation of package âRcppClassicâ had non-zero exit status

然后我尝试并能够使用“sudo apt-get install r-cran-rcpp”安装 Rcpp:

$ sudo apt-get install r-cran-rcpp                                             
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgudev-1.0-0 gir1.2-gudev-1.0
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  littler r-cran-int64
Suggested packages:
  r-cran-getopt r-cran-inline
The following NEW packages will be installed:
  littler r-cran-int64 r-cran-rcpp
0 upgraded, 3 newly installed, 0 to remove and 3 not upgraded.
Need to get 2,899 kB of archives.
After this operation, 11.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ precise/universe littler amd64 0.1.5-1 [32.2 kB]
Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ precise/universe r-cran-int64 amd64 1.1.2-1 [359 kB]
Get:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ precise/universe r-cran-rcpp amd64 0.9.9-1 [2,508 kB]
Fetched 2,899 kB in 0s (8,959 kB/s)
Selecting previously unselected package littler.
(Reading database ... 60157 files and directories currently installed.)
Unpacking littler (from .../littler_0.1.5-1_amd64.deb) ...
Selecting previously unselected package r-cran-int64.
Unpacking r-cran-int64 (from .../r-cran-int64_1.1.2-1_amd64.deb) ...
Selecting previously unselected package r-cran-rcpp.
Unpacking r-cran-rcpp (from .../r-cran-rcpp_0.9.9-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up littler (0.1.5-1) ...
Setting up r-cran-int64 (1.1.2-1) ...
Setting up r-cran-rcpp (0.9.9-1) ...

但是当我尝试在 R 中安装“reshape2”时,我收到了与以前相同的错误消息。

我不明白为什么我会收到错误消息:

Warning: dependency âRcppâ is not available

因为 'sudo apt-get install r-cran-rcpp' 工作

经过一番搜索,我在这里找到了关于如何使用 RcppClassic 的小插图:http://cran.r-project.org/web/packages/RcppClassic/vignettes/RcppClassic-intro.pdf

但是,对DESCRIPTION、NAMESPACE 和 MAKEVAR 文件进行修改开始超出我的能力范围,因此我正在寻求帮助。

这是 sessionInfo() 的输出:

> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

提前致谢!

编辑 3/15/2014: 我的“用例”是我在 AWS EC2 实例上运行一系列定期作业,因此我不需要最新/最强大的软件功能。我在我的 Mac 开发机器上使用 R 2.15 可以正常工作,所以我只是想将我拥有的东西移植到我的 AWS EC2 Ubuntu 实例中。

我使用的包是:reshape2、xlsx(和 xlsxjars)、RJSONIO、stringr、R2HTML、RCurl、plots、lattice、latticeExtra、gdata 和 ggplot2。

【问题讨论】:

  • 我认为 reshape2 包含在默认的 R 安装中。
  • @Fernando,这是不正确的。 Marc471,您使用的哪些包不适用于 R 3.x?
  • @Ananda 对不起,我不知道……但我总是需要(reshape2),从不 install.packages('reshape2')。在 linux 和 Mac OSX 上都可以。
  • @Fernando,它很可能是在您安装另一个需要它的软件包时安装的。
  • @AnandaMahto 很高兴知道谢谢!我一直认为 reshape2 是默认出现的。

标签: r ubuntu-12.04 plyr rcpp reshape2


【解决方案1】:

一些事情:

  1. 您坚持使用 Ubuntu 12.04 LTS。稳定的分布。那也行。你的选择。这也意味着您选择在 2012 年 4 月前几个月冻结您的软件。

  2. 现在你想从 CRAN 那里得到一些东西。当前的东西。这与上一点相冲突。

  3. 要么留在发行版中。或者你成为最新的。

  4. 阅读 Ubuntu README 并了解如何使用 Ubuntu 12.04同时获得最新的 R 包

  5. 通过该存储库安装 R 3.0.3(当前)。

  6. 将所需的 CRAN 包安装到 /usr/local/lib/R/site-library

【讨论】:

  • 没错。正如这首歌所说,“你不能总是得到你想要的//但如果你有时尝试//你可能会找到//你得到你需要的”
  • 如果可以的话,我会加 10 条评论 :)
  • @Dirk - 我只使用了 Ubuntu 12.04 LTS,因为这是我在 2013 年开始这个项目时 AWS EC2 上当前的“Linux”产品。如果它使我不喜欢那个版本做我想做的更容易(如果可能的话,保持 R 2.15)。我用我的用例更新了我的原始帖子,这有望解释我为什么要走这条路。我会查看您发送的链接,看看我现在是否可以将所有内容升级到 R 3.0。
  • 我明白了。是的,LTS 在服务器上很常见。但是我提供的链接将引导您到 CRAN 上的 Ubuntu 存储库,我们中的许多人使用它来拥有当前的 R 二进制文件。另请查看 Michael 的 c2d4u 存储库。
  • @Dirk - 我能够使用您提供的说明在 Ubuntu 12.04 LTS 上运行的 R 3.0 上安装我需要的所有软件包(包括本文的主题:reshape2)。谢谢!
猜你喜欢
  • 2023-03-20
  • 1970-01-01
  • 1970-01-01
  • 2022-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-07
  • 1970-01-01
相关资源
最近更新 更多