How to Upgrade to R 4.0.0 on Debian
This article is for you if you get the following error message:
r-base : Depends: r-recommended (= 4.0.0-1~bustercran.0) but it is not going to be installed
Woah!
R 4.0.0 is finally out!
That might sound super geeky, but that’s the first time I feel so excited for a major version of whatever technology.
I was still a kid when R 3.0.0 got out.
But nowadays, I do R every day. I eat R. I sleep R. I am R.
(Ok I’ll stop.)
This article is not here to tell you what’s new in R 4.0.0.
You can refer to this article instead:
Or the official message:
In this article, I want to show you how to upgrade R on Debian.
Because I struggled.
And I don’t want anyone else to struggle too.
Starting point
Pretty much all my servers use Debian. It’s stable. It just works.
But when you install R on a fresh Debian, you get R 3.5.2.
Who would want to use R 3.5.2 in 2020?
So, to install the latest version, you must:
- Add a GnuPG key
- Add the repo address of R
And in this article, I’ll suppose you have already done that.
That means you’re probably currently using R 3.6.3 and you want to upgrade.
But, like me, you got trouble.
If you open /etc/apt/sources.list
on your server, you should see this line:
On this line, we can see two things:
- I’m using
buster
, which is Debian 10. - And the
cran35
gives me access to the latest version of R 3.x.x.
The naive solution
So if you want to update R, you simple update the repo address, then apt update
, and finally apt upgrade
.
Not this time.
But let’s try!
The new address is:
If I replace it in my /etc/apt/sources.list
file, and then I do:
A few libraries will be updated, but not R. Instead, we will get told this:
Why?
Because of conflicts in the dependencies.
You can try to force the install though:
Except it doesn’t work either.
You’ll get this message:
Not cool.
So what do we do?
The good solution
In fact, everything is explained on the CRAN website.
Here: Installation instructions.
First, they give you the new repo address. That’s good. We’ve already done that.
And then they say:
Please refer to the section on bullseye above for hints on how to do the reinstallation of extension packages. Of course you need to substitute “bullseye” for “buster” if this is the distribution you are working with.
Oh.
Right.
Instead of writing sudo apt install r-base
, let’s try:
These commands uninstall R first. And then install it again with this new parameter.
And it works!
Happy R ;)
Comments
Marco
Thank you for your R4.0 installation tips. Very helpful and I managed to install it on my Linux Mint now. :-)
Craig
I am using Debian (buster) which is an app on a new Lenovo Chrombook. I am following all of these instructions but I get the message below. Do you have any ideas? No matter what I do, I can’t get a more recent version of R than 3.5.2… Thank you….
The following packages have unmet dependencies:
r-base : Depends: r-base-core (>= 4.0.3-1~bustercran.0) but 3.5.2-1 is to be installed
Depends: r-recommended (= 4.0.3-1~bustercran.0) but it is not going to be installed
Recommends: r-base-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Charles
Hi Craig!
You haven’t explicitely mentioned it, so have you tried the last two lines of the article? Uninstall first, then install again with the correct repo.
Also, to fully understand your situation, can you let us know: - What is displayed when you run
cat /etc/issue
?- Did you uninstall all R-related apt packages?
- What happens if you try to install r-base-core directly?
In the article I provide what worked for me when I faced this issue, but I had to try many things to understand what was going on.
Boris Shor
I have the same problem with installing to a Lenovo Chromebook Duet (arm64) which is running Debian 10 - Buster. Only 3.5.2 is installed even after updating sources.list.
Jorg
My issue is slightly different: I am trying to import the public key, but receive the message “no dirmngr”. But that is a lie: dirmngr is installed and lives in the standard location.
Just another of the bugs present in the new Debian that is beginning to make me doubt its utility.
Victor
Thanks!!! your post help me a lot!
Leave a Comment
Required fields are marked *