Installing R 4.0.3 on Raspberry Pi 4 with Ubuntu 20.10

I am trying to install R 4.0.3 on a Raspberry Pi 4 running Ubuntu 20.10 64-bit. It is fully updated.

Before I did anything, I added the correct CRAN repository for this OS using sudo add-apt-repository 'deb groovy-cran40/'.

When I run sudo apt install r-base, I get an error that r-base-core and r-recommended, both of which are specified to require version >= 4.0.3-1.2010.0, are "not going to be installed".

Checking them individually, it seems that r-base-core is the problem. If I try to install r-recommended by itself, I get an error that it needs "r-base-core (>= 4.0.3-1.2010.0) but 4.0.2-1build1 is to be installed".

If I check, I notice that r-base-core 4.0.3 is only available in an AMD64 variant, per the amd64 in the filenames. I observe that the r-base package's files do not have amd64 in their filenames. To me, that suggests that, currently, you're only running R 4.0.3 on Ubuntu 20.10 if you are on an Intel/AMD 64-bit platform. seems to back that up.

Are there practical alternatives, other than to wait for an r-base-core 4.0.3 package to appear that is compatible with more platforms?

1 Like

There are no recent binaries for R on Ubuntu repos, you have to compile from source, it is pretty simple, just use these commands.

sudo apt-get install -y gfortran libreadline6-dev libx11-dev libxt-dev \
                               libpng-dev libjpeg-dev libcairo2-dev xvfb \
                               libbz2-dev libzstd-dev liblzma-dev \
                               libcurl4-openssl-dev \
                               texinfo texlive texlive-fonts-extra \
                               screen wget libpcre2-dev
cd /usr/local/src
sudo wget
sudo su
tar zxvf R-4.0.3.tar.gz
cd R-4.0.3
./configure --enable-R-shlib #--with-blas --with-lapack #optional
make install
cd ..
rm -rf R-4.0.3*

Edit: Sorry, I didn't take into account that you are using Ubuntu instead of Raspberry Pi OS (Debian based) so the system dependencies might be named different.

1 Like

I just figured it out. The fact that headers are needed suggests I need zlib1g-dev, too. I installed it and got past it. Finding I may need other packages, too. Working through it now, and will post update later.

It works! All I needed were a few additional libraries. I posted the steps at

If you would like to get StackOverflow points, you can answer my question at Otherwise, I'll put in basically what I have on my blog.

1 Like

Nice!, in case you want a starting point to set up a fully functional data science server with R on a Raspberry Pi you can take a look at my installation guide, although, it is a little outdated since I haven't had the opportunity to completely update my setup.

I'm also planning to put together an Ansible Playbook to automate all these tedious processes but it is going to take a while.

1 Like

It seems like a container would be a good way to solve this?

I'm aware of that option, and for deployments, I think it is the best choice but for general use, I find a regular installation simpler to manage and easier to keep up to date, although, this is completely opinionated.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Sorry I can't be of help, last time I tested this was with Raspbian Stretch and I don't have a spare Raspberry Pi to test with newer OSs right now.

Thank you. All the packages installed successfully, so your suggested packages appear to have been spot on. Ubuntu is also Debian-based, so I am not surprised it worked.

Running configure is failing with this:
checking whether zlib support suffices... configure: error: zlib library and headers are required

dpkg -s zlib1g says I have zlib 1:1.2.11.dfsg-2ubuntu4 installed.

Scratching my head and trying to figure this one out.