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 long time.

  1. sudo apt update
  2. sudo apt upgrade
  3. 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
  4. cd /usr/local/src
  5. sudo wget
  6. sudo su
  7. tar zxvf R-4.0.3.tar.gz
  8. cd R-4.0.3
  9. ./configure --enable-R-shlib
  10. make
  11. make install
  12. cd ..
  13. rm -rf R-4.0.3*
  14. exit
  15. cd

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