Unable to install latest R version on Ubuntu 18.04 linux

I want to be able to install the latest stable R release for Ubuntu 18.04, I had the ubuntu version installed and so I removed it and then followed several guides like in this link.

No matter what I do I get the following output when I issue a sudo apt-get install r-base:

sudo apt install r-base
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-base-core (>= 3.6.1-3disco) but it is not going to be installed Depends: r-recommended (= 3.6.1-3disco) 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.

What's wrong? (I did all the apt update etc.)

2 Answers

For anyone that experiences the same problem, I found the solution in:Unable to install R 3.5.0 in Ubuntu Bionic Beaver (18.04)

I simply issued these commands in order and then was able to install:

  1. Temporarily removed deb bionic-cran35/ from /etc/apt/sources.list
  2. sudo apt-get autoremove sudo apt-get update sudo apt-get upgrade
  3. Added back deb bionic-cran35/ to /etc/apt/sources.list
  4. sudo apt-get update
  5. sudo apt-get install r-base

And that was it (installed R 3.6.1).

1

This solution worked for me:

  1. Install the packages necessary to add a new repository over HTTPS:

sudo apt install apt-transport-https software-properties-common

  1. Enable the CRAN repository and add the CRAN GPG key to your system using the following commands:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

sudo add-apt-repository 'deb bionic-cran35/'

  1. Now that the apt repository is added, update the packages list and install the R package by typing:

sudo apt update sudo apt install r-base

  1. To verify that the installation was successful run the following command which will print the R version:

R --version

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like