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 https://cloud.r-project.org/bin/linux/ubuntu 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".
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 https://cran.rstudio.com/src/base/R-4/R-4.0.3.tar.gz
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
make install
cd ..
rm -rf R-4.0.3*
exit
cd
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.
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.
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.
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.
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.