rasp14
Posts: 54
Joined: Sun Jun 22, 2014 2:49 pm

[R 3.1.2] Error when installing packages from CRAN

Sun May 24, 2015 12:52 pm

Hi All,

I've just build R 3.1.2 from source and install in my raspberry pi model B+. I've follow instruction from 2nd post in link below.
http://stackoverflow.com/questions/2830 ... bian-fails

After that I tried to start R and it works, when i tried to install packages from CRAN then this failure comes up:

Code: Select all

system call failed: cannot allocate memory
I was trying to install RSQLite package. Somehow it didn't work.

Code: Select all

install.packages("RSQLite")
I wonder if anyone tried R 3.1.2 in rapsberry pi B+ before? Searched google but nothing useful found. What i tried so far is to comment out "gpu_mem=128" in config.txt, verify that memory consume by gpu is only 64MB and try to install package again but no luck. Need a little help here.

Regards.

rasp14
Posts: 54
Joined: Sun Jun 22, 2014 2:49 pm

Re: [R 3.1.2] Error when installing packages from CRAN

Tue May 26, 2015 4:01 pm

No one can help me with this? I'm using raspbian. I already run sudo apt-get update and upgrade before compile the R 3.1.2 from source. Not sure if it will help if i use latest image from homepage. Will try soon.

rasp14
Posts: 54
Joined: Sun Jun 22, 2014 2:49 pm

Re: [R 3.1.2] Error when installing packages from CRAN

Sat May 30, 2015 1:28 pm

For those who might doing same stuff like me, here is how i fix the issue.

1. Guess this is really an out of memory issue, some how Pi runs out of memory when installing RSQLite package. So you have to increase swap file size to prevent the out of memory error kicks in.
2. Type in command "sudo nano /etc/dphys-swapfile" without the quote.
3. edit the line "CONF_SWAPSIZE=100" to "CONF_SWAPSIZE=1024" (I'm using model B with 512MB, so the recommended value is 2*RAM size, and of course you need a bigger SD card at least 2GB free space available)
4. Save the change to dphys-swapfile file and go to root directory using cd /
5. type in "sudo /etc/init.d/dphys-swapfile stop" to stop the current swap file
6. type in "sudo /etc/init.d/dphys-swapfile start" to create new swap file with 1024MB size, you should see a message "generating swapfile ... of 1024MBytes"
7. Start R and install RSQLite package like normal, you should not see the error anymore. It will take a while to complete the installation.
8. You can repeat step 2 to step 6 if you don't want to allocate 1GB for swap file, change back CONF_SWAPSIZE to 100 to get back the space u need.

Thank you.

0tszd
Posts: 1
Joined: Tue Jul 12, 2016 7:34 am

Re: [R 3.1.2] Error when installing packages from CRAN

Tue Jul 12, 2016 8:03 am

Thank you!
This fix was still needed for me when installing XML on an Pi 2 model B, Raspbian Jessie.

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 16 guests