1
votes

I have installed amazon free trial linux t2.micro instance, and I installed RStudio, but when I try to install packages on R I get this error:

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

Even when I run a simple in R.

1+1

I get the same error:

system call failed: Cannot allocate memory

2
@tobassist No, it doesn't work for me.Sasa88

2 Answers

3
votes

The problem is with the t2.micro instance. It has only 1GiB of Memory.

Choosing a larger instance would be the appropriate solution here. If you want to stick with the Free Tier eligible instance (t2.micro), one possible solution would be is to add some swap space.

Create a swap file for 1G (increase the value of count accordingly to increase the swap file size)

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

And, add this entry to /etc/fstab

/swapfile swap swap defaults 0 0
0
votes

Based on the answer of @franklinsijo, i added a swap space according to the more detailed solution in this link https://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/