Ubuntu – Unable to install R 3.5.0 in Ubuntu Bionic Beaver (18.04)

18.04rsoftware installation

I was delighted to hear that R developers finally shipped R 3.5 through their CRAN mirrors and decided to install it immediately.I added the requisite PPA as mentioned in the CRAN website,deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu bionic-cran35/ but after running the commandsudo apt-get update,I found the following warning.

expected bionic-cran35/ but got bionic

The screenshot is attached here for further clarity.

I was too optimistic and went on with the next codesudo apt-get install r-base and as expected, the installation failed. The errors are shown here.

   Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 r-base : Depends: r-recommended (= 3.5.0-1bionic) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

It is worth mentioning that it is not a secure APT related problem and I had already added the required apt-key . Also, I do not have any previous R installation in my system.I need the updated version out there.(The R in Bionic Universe is still 3.4.4)

Am I missing something?

UPDATE : The bug has been fixed by Michael Rutter and his Debian team. A big thanks to everyone involved.

Best Answer

I am posting this answer so that it might help someone stumbling over the same problem. The problem was solved with a roundabout trick - it was experimental but it did work out.

So, I was trying to install R 3.5.0 from CRAN directly and it refused to get installed as mentioned in the question. The idea was to install whatever existing version in Ubuntu Bionic (18.04) and upgrade to 3.5.0 (instead of installing R from scratch).

The detailed steps are :

  1. For now remove the source deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ from Software sources.

  2. Basic cleanup :-

    sudo apt-get autoremove
    sudo apt-get update
    sudo apt-get upgrade
  3. Install whatever existing version in Ubuntu Bionic with

    sudo apt-get install r-base
  4. Re-add the source deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/

  5. sudo apt-get update

    -- still shows the warning expected bionic-cran35/ but got bionic

    Ignore and proceed with sudo apt-get upgrade

  6. Upgrade all the existing packages in Linux

    sudo apt-get dist-upgrade

And the last command (6th) actually does the job --- R 3.5.0.

PS - The warning still displays in the screen when I update the sources but right now appears to be innocuous. Hopefully the next R update will fix that.

UPDATE : Infact, the bug has been fixed. So we can directly install R as per CRAN website from now on.

Related Question