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

13,385

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.

Share:
13,385

Related videos on Youtube

pineapple
Author by

pineapple

Updated on September 18, 2022

Comments

  • pineapple
    pineapple over 1 year

    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. R_Bionic_installation_error

    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.

    • pineapple
      pineapple almost 6 years
      Thank you @steeldriver for your quick response. I have edited the question with the required error codes.Please note that I am trying to install base R with sudo apt-get install r-base code.
    • N0rbert
      N0rbert almost 6 years
      It seems that you should contact Michael Rutter and inform him about two problems - warning W: Conflicting distribution: http://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease (expected bionic-cran35/ but got bionic) and dependency problem while installing r-base. As temporary solution you can use marutter PPA as described in this answer.
    • pineapple
      pineapple almost 6 years
      Thanks @N0rbert for the suggestion. Sure, I will send a mail to the mailing list.
  • esperluette
    esperluette over 5 years
    This helped me: r-bloggers.com/…
  • user30994
    user30994 almost 4 years
    Same problem cropped up again when I try installing R4.0.1. In short on my brand new Ubuntu 18.04 instance I added the line deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ in the /etc/apt/sources and ran sudo apt-get install r-base. It installed "R version 3.4.4 (2018-03-15)". What is the problem please and is there a separate solution for R 4.0.1?
  • Johan Larsson
    Johan Larsson over 3 years
    @user30994 In terminal, do you get The following signatures couldn't be verified ... error? If so, then check the Secure APT section of cran.r-project.org/bin/linux/ubuntu