install.packages R在Ubuntu 12.04下载,但不安装包

时间:2022-02-14 14:14:23

I'm perplexed. I've done this process a dozen times and never had this issue.

我很困惑。我已经完成了这个过程十几次,从来没有遇到过这个问题。

I installed the latest version of R for Ubuntu

我为Ubuntu安装了最新版本的R.

I enter R, no issues at all, gives me the latest version, and I can load native packages.

我输入R,没有任何问题,给我最新版本,我可以加载本机包。

But When I try to install new packages, they download, but I get nothing. For example, if I install ggplot2:

但是当我尝试安装新软件包时,他们会下载,但我什么都没得到。例如,如果我安装ggp​​lot2:

> install.packages("ggplot2")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘colorspace’, ‘stringr’, ‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’, ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’

trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/colorspace_1.2-4.tar.gz'
Content type 'application/x-gzip' length 242791 bytes (237 Kb)
opened URL
==================================================
downloaded 237 Kb

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

[snip ... ]

trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/ggplot2_0.9.3.1.tar.gz'
Content type 'application/x-gzip' length 2330942 bytes (2.2 Mb)
opened URL
==================================================
downloaded 2.2 Mb


The downloaded source packages are in
        ‘/tmp/RtmpoPUAFL/downloaded_packages’
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’

I've completely purged files a number of times, but not with any luck.

我已经完全清除了文件很多次,但运气不好。

I'm logged in as root.

我以root身份登录。

I feel like I'm missing something obvious? I don't know -- I've done this same thing a dozen times on Ubuntu, Mac, Windows, and Debian. Help?

我觉得我错过了一些明显的东西?我不知道 - 我在Ubuntu,Mac,Windows和Debian上做了十几次同样的事情。帮帮我?

3 个解决方案

#1


7  

@jdharrison helped out. The problem was insufficient memory on the VPS I was running, so I added some swap as described here:

@jdharrison帮了忙。问题是我正在运行的VPS内存不足,所以我添加了一些交换,如下所述:

How do you add swap to an EC2 instance?

如何将交换添加到EC2实例?

#2


3  

Look at the last lines:

看看最后几行:

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

You have to go to the directory /tmp/RtmpoPUAFL/downloaded_packages (cd ...) and then install them manualy in the order that is pointed out above. So

你必须转到目录/ tmp / RtmpoPUAFL / downloaded_pa​​ckages(cd ...),然后按照上面指出的顺序手动安装它们。所以

R CMD INSTALL colorspace_1.2-4.tar.gz
R CMD INSTALL stringr_0.6.2.tar.gz
R CMD INSTALL ggplot2_0.9.3.1.tar.gz

Then trylibrary(ggplot2) now it should work

然后trylibrary(ggplot2)现在它应该工作

I have no idea why you have to do this sometimes... I anyone knows i am happy to learn it as well.

我不知道为什么你有时必须这样做...我知道我也很乐意学习它。

#3


3  

If your server does not have enough ram, R can not install packages.

如果您的服务器没有足够的RAM,则R无法安装软件包。

The solution is to either increase the physical ram, or increase the size of the swap file.

解决方案是增加物理内存,或增加交换文件的大小。

Create a 2 gig swap file

创建一个2 gig交换文件

sudo fallocate -l 2G /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img

You can see how much free swap is available with the swapon command

您可以使用swapon命令查看可用的可用交换量

root@foo:# swapon -s
Filename                Type        Size    Used    Priority
/swap.img                               file        2097148 213388  -1

#1


7  

@jdharrison helped out. The problem was insufficient memory on the VPS I was running, so I added some swap as described here:

@jdharrison帮了忙。问题是我正在运行的VPS内存不足,所以我添加了一些交换,如下所述:

How do you add swap to an EC2 instance?

如何将交换添加到EC2实例?

#2


3  

Look at the last lines:

看看最后几行:

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

You have to go to the directory /tmp/RtmpoPUAFL/downloaded_packages (cd ...) and then install them manualy in the order that is pointed out above. So

你必须转到目录/ tmp / RtmpoPUAFL / downloaded_pa​​ckages(cd ...),然后按照上面指出的顺序手动安装它们。所以

R CMD INSTALL colorspace_1.2-4.tar.gz
R CMD INSTALL stringr_0.6.2.tar.gz
R CMD INSTALL ggplot2_0.9.3.1.tar.gz

Then trylibrary(ggplot2) now it should work

然后trylibrary(ggplot2)现在它应该工作

I have no idea why you have to do this sometimes... I anyone knows i am happy to learn it as well.

我不知道为什么你有时必须这样做...我知道我也很乐意学习它。

#3


3  

If your server does not have enough ram, R can not install packages.

如果您的服务器没有足够的RAM,则R无法安装软件包。

The solution is to either increase the physical ram, or increase the size of the swap file.

解决方案是增加物理内存,或增加交换文件的大小。

Create a 2 gig swap file

创建一个2 gig交换文件

sudo fallocate -l 2G /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img

You can see how much free swap is available with the swapon command

您可以使用swapon命令查看可用的可用交换量

root@foo:# swapon -s
Filename                Type        Size    Used    Priority
/swap.img                               file        2097148 213388  -1