Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R package install dplyr on AWS t2.micro freezing

I have an Rescript that I have written, it is working on my Mac osX with all of the dependencies.

I have now setup a t2.micro on AWS and have install R with no issues. When I run

install.packages("dplyr")

it just freezes on this line

g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"  -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c dplyr.cpp -o dplyr.o

I left it for a couple of hours with no changes. It looks like the CPU is peaking out as we'll.

What should I do?

like image 577
Chris Evans Avatar asked Oct 20 '25 01:10

Chris Evans


2 Answers

For anyone who has this same issue see below for how I resolved it.

The issue was that the t2.micro did not have the power to install the dependencies for the script.

So how did I get around the issue then? I created a t2.large installed all of the dependencies from the command line. Then from the AWS console created a snapshot, converted it to an image, then a volume an then attached it to a new t2.micro and it is now working.

https://www.youtube.com/watch?v=W89C_OqlOwE

like image 69
Chris Evans Avatar answered Oct 21 '25 15:10

Chris Evans


Whilst re-sizing the instance is a viable option, if you absolutely do want to stay within the free-tier’s t2.micro instance you can borrow this Raspberry Pi user’s trick and set up a swap space. The below code sets up a 3GB file for memory swapping.

https://community.rstudio.com/t/setting-up-your-own-shiny-server-rstudio-server-on-a-raspberry-pi-3b/18982

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=3072
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
sudo sh -c 'echo "/var/swap.1 swap swap defaults 0 0 " >> /etc/fstab'

Then install dplyr as usual, e.g.

sudo su - -c "R -e \"install.packages('dplyr', repos='http://cran.rstudio.com/')\""

The swap space won’t be particularly fast as its on EBS but it will get the job done. I did this on a t2.micro ubuntu 18.04 instance last night

like image 45
Martin Avatar answered Oct 21 '25 17:10

Martin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!