在rstudio服务器ubuntu 12.04.1上安装软件包

时间:2015-04-29 04:13:41

标签: r ubuntu amazon-web-services amazon-ec2

我按照randyzwitch的博客(http://randyzwitch.com/r-amazon-ec2/)上的说明在运行ubuntu 12.04的ec2实例上安装r-studio服务器。

当我启动r-studio服务器并尝试安装软件包时,就会发生这种情况:

> install.packages("dplyr")
Warning in install.packages :
  package ‘dplyr’ is not available (for R version 2.14.1)
Installing package(s) into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to create a personal library
~/R/x86_64-pc-linux-gnu-library/2.14
to install packages into?  (y/n) y
Warning in install.packages :
  package ‘dplyr’ is not available (for R version 2.14.1)

我意识到我需要更新R所以我查看了这篇文章并更新了它:https://askubuntu.com/questions/218708/installing-latest-version-of-r-base/436491#436491

我以sudo用户身份登录。当我尝试现在安装包时,我明白了:

> install.packages("plyr")
Installing package into ‘/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘Rcpp’

trying URL 'http://cran.rstudio.com/src/contrib/Rcpp_0.11.5.tar.gz'
Content type 'application/x-gzip' length 2353791 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

trying URL 'http://cran.rstudio.com/src/contrib/plyr_1.8.2.tar.gz'
Content type 'application/x-gzip' length 392136 bytes (382 KB)
==================================================
downloaded 382 KB

Warning in install.packages :
  system call failed: Cannot allocate memory
Warning in install.packages :
  installation of package ‘Rcpp’ had non-zero exit status
Warning in install.packages :
  system call failed: Cannot allocate memory
Warning in install.packages :
  installation of package ‘plyr’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp6Kgx5d/downloaded_packages’

我看过这篇文章:lme4 package install failing on Ubuntu 12.04并遵循所有说明,但它没有解决问题。还是一样的结果。尝试在aws上运行rstudio服务器时非常沮丧。有人请帮忙!

2 个答案:

答案 0 :(得分:0)

您使用的是实例类型t2.micro吗?尝试使用功能更强大的更强大的实例,这对我有用。

答案 1 :(得分:0)

在安装软件包时,请确保您是root用户:

  1. sudo su命令将带您到root用户。然后运行您的安装软件包代码。
  2. 或在运行脚本之前使用sudo:sudo Rscript 1.R