Raspberry Pi 4

Installing R on Raspberry Pi 4 with Ubuntu 20.10 (64-bit)

The Raspberry Pi 4 is a great incremental improvement of the RPi platform. It handles Ubuntu 20.10 64-bit decently.

I mainly use R for my data-science practice, and I wanted to try R on this RPi. As of November 29, 2020 there are no pre-built packages I can use to install R. At a minimum, no r-base-core package is available for the arm64 platform at the R package repository. You have to compile R yourself.

Here’s a way to do it. AndrĂ©s Castro Socolich provided most of this, and I edited a couple of steps. Open a terminal window (Ctrl-Alt-T) and run the below lines, one at a time. Be advised: I have an RPi 4 with 8 GB RAM, and it used almost half the RAM at one point. Also, the first make command will take a very long time.

  1. sudo apt-get install -y gfortran libreadline6-dev libx11-dev libxt-dev libpng-dev libjpeg-dev libcairo2-dev xvfb libzstd-dev texinfo texlive texlive-fonts-extra screen wget zlib1g-dev libbz2-dev liblzma-dev libpcre2-dev libcurl4-openssl-dev openjdk-11-jdk
  2. cd /usr/local/src
  3. sudo wget https://cran.rstudio.com/src/base/R-4/R-4.0.3.tar.gz
  4. sudo su
  5. tar zxvf R-4.0.3.tar.gz
  6. cd R-4.0.3
  7. ./configure --enable-R-shlib
  8. make
  9. make install
  10. cd ..
  11. rm -rf R-4.0.3*
  12. exit
  13. cd

You’re done! To run R, type R (yes, capital R) at the command prompt.

5 thoughts on “Installing R on Raspberry Pi 4 with Ubuntu 20.10 (64-bit)”

  1. Have you noticed that you have several repeated packages? it doesn’t make any harm but still unnecesary.
    e.g. libbz2-dev, liblzma-dev, libpcre2-dev, libcurl4-openssl-dev

    1. Not yet. I last tried about 15 days ago. I think there was a QT-related dev package that was needed, and I had problems getting it compiled or something. I do not specifically remember.

Leave a Reply

Your email address will not be published. Required fields are marked *