Install readr package on EC2 instance

readr

#1

Hi,
I am trying to install readr package (because I need kableExtra package) on an AWS EC2 instance.
But I keep receiving this error:

virtual memory exhausted: Cannot allocate memory
make: *** [Collector.o] Error 1

Isn't there a way to install it without having to increase the memory?
Thanks.
M


#2

What EC2 instance are you running? Have you run $ top and seen what memory usage you're at before trying to install the package?

It's likely that you're already at the max.


#3

I am on the t2.small (2GB)

Here is the memory usage I have:

1

I do not know how to empty the memory on CentOs and did not find the answer


#4

Hmmm. Perculiar, is there anyway you can run install whilst also running $ top?

I use tmux on my instances so I can split my terminal, it would be interesting to see if the memory usage of R actually hits the limit when its installing. You could just open two terminal windows.

Apart from that, you could try gc() after every time you install a package, but that's not very handy if you're doing them all in a install.packages(c(<list of things>)) way.


#5

I just tried, you can see below:


#6

Did you manage to run $ top alongside to see the real memory usage?

Other than seeing what that gives you, I'm assuming 2GB probably isn't enough unfortunately.


#7

https://github.com/tidyverse/readr/issues/544 would suggest 2GB probably isn't enough, either try to download the binary as the solution near the bottom mentions or bump up your memory, hope this helps!


#8

Yes I saw it but it is only for Ubunto not CentOs.
So yes I will have to bump up my memory and pay for the t2.medium
I hope it is possible to planning to stop and restart the instance each day so that I only run it for 2 hours per day for example, as I dont want my costs to explode !


#9

You should be okay, are you within the Free Tier period? I'm currently running two t2.larges for about 4 hours a day and I'm incurring no charges...

If you don't want to use a bigger instance: https://builder.r-hub.io looks like you can download the source and compile it on this site, if you select advanced you can select CentOs. Probably worth a try!


#10

Upgraded to t2.small and it works now. Praying for a low cost ! Thank you @ciaranevans


#11

@Maverick hope it works out! You can set a alert on AWS to tell you immediately when you're incurring charges if you want to play it safe! But with careful uptime and usage you should stay under the limit :smiley:


#12

I pay 10$ / month its worth it !