R (Ubuntu) - Can't install packages "readr" and "eurostat"
Asked Answered
D

2

6

I have a problem with installing "eurostats" package in R. After breaking down the problem, I deduced that the problem lies with "readr" package. Trying to install it, this occurs:

* installing *source* package ‘readr’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG   -I"/home/shiny/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include" -I"/home/shiny/R/x86_64-pc-linux-gnu-library/3.3/BH/include"   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c Collector.cpp -o Collector.o

after which the terminal just freezes as if it is active but nothing happens.Prior to this, I kind of tackled with locale settings (just mentioning it if it helps). I was able to install other packages.

My R and Linux details are as follows:

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] httr_1.2.1      R6_2.2.0        tools_3.3.2     withr_1.0.2    
[5] curl_2.2        memoise_1.0.0   git2r_0.16.0    digest_0.6.10  
[9] devtools_1.12.0

Could someone please help me?

Deitz answered 3/12, 2016 at 7:50 Comment(3)
How long did you wait after freeze? Is terminal working (cpu/memory uasge)? Are your packages up to date (old.packages(checkBuilt=TRUE), especially Rcpp and BH)?Smarten
I waited for about an hour. The terminal was and is working. The packages are up to date.Deitz
I just found that a similar (if not identical) issue was reported github.com/tidyverse/readr/issues/544. Is this the case or something else?Deitz
U
13

You have insufficient RAM on that machine. So you have two options:

  • continue what you are doing and trying to compile from source, which will need more memory and is likely to fail

  • install a prebuilt binary (!!) so that you do not have to compile in the first place

The easiest way is something like this (and I am showing only the commands, not the output while I do this in a Docker instance of Ubuntu 16.04, and I am doing this in Docker where the account is root; otherwise add sudo in front)

apt-get update     # refresh
apt-get install software-properties-common
add-apt-repository -y "ppa:marutter/rrutter"
add-apt-repository -y "ppa:marutter/c2d4u"
apt-get update     # now with new repos
apt-get install r-cran-readr

and voila you have the readr package. Now proceed for eurostat which is not packaged as a binary, but may not require heavier resources which readr does due to its C++ code.

Unlisted answered 3/12, 2016 at 15:59 Comment(2)
Yes, that worked for me fine! Thank you for your solution @DirkEddelbuettelDeitz
Do you have a solution for installing readr on CentOS facing the same issue of insufficient RAM?Tael
H
5

I had the same problem on my raspberry pi. The workaround was to increase the size of the swap (in my case to 1Gb). Here are the steps:

sudo swapon -s #get size and filename
sudo swapoff -a #stop the actual swaps
sudo fallocate -l 1g swap2 #allocate 1Gb for the swapfile
sudo mkswap swap2
sudo swapon swap2

Start R and install your packages.

If you need to get back to your previous config:

sudo swapoff -a
sudo rm swap2
sudo swapon your-previous-swap
Hylomorphism answered 4/8, 2017 at 13:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.