Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install modules, Cannot allocate memory error?

I just launched a new EC2 ubuntu t1.micro. I installed R 3.1.2 and when I try to install any module I get:

Warning messages:
1: In system2(cmd0, args, env = env, stdout = outfile, stderr = outfile) :
  system call failed: Cannot allocate memory
2: In install.packages("zoo") :
  installation of package ‘zoo’ had non-zero exit status

I read on another question that this might be because of the swap memory, but in my case the memory is set to 60 which I think should be all right.

When I run .libsPaths() I get

> .libPaths()
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"      
[3] "/usr/lib/R/library"

At first R was complaining that it did not had permission to write on /usr/lib/R/library, but after I changed the directory permissions that error went away.

Any clue on how to get it to work will be appreciated. Thanks

like image 979
JordanBelf Avatar asked Jan 27 '15 23:01

JordanBelf


2 Answers

So I tested doing the exact same under a bigger (t1.small) instance and it worked fine. It looks like R does not play good with EC2 t1.micro instances.

The main difference between those 2 types of instances is that while the t1.micro has 0.6GB memory the t1.small has 1.7GB.

Couldn't test it under t2 type instances, they might perform better.

like image 60
JordanBelf Avatar answered Sep 19 '22 10:09

JordanBelf


Found a workaround. You can use Rscript form command line:

Rscript -e "install.packages('urca', repos='http://cran.us.r-project.org')"

Worked with AWS, Amazon Linux, t2.micro instance.

like image 31
cure Avatar answered Sep 23 '22 10:09

cure