1

I am trying to install R version 4.0.2 on ubuntu 18.04 but it shows this message:

The following packages have unmet dependencies:
 r-base : Depends: r-base-core (>= 4.0.3-1.2004.0) but it is not going to be installed
          Depends: r-recommended (= 4.0.3-1.2004.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.
Mark dG
  • 321
  • 1
  • 13
  • Does this answer your question? [Receiving "Unmet dependency" while installing r-base on Ubuntu 14.10](https://stackoverflow.com/questions/28273441/receiving-unmet-dependency-while-installing-r-base-on-ubuntu-14-10). Or maybe [Having difficulty with re-installing R in Ubuntu 18.04](https://stackoverflow.com/questions/62166039/having-difficulty-with-re-installing-r-in-ubuntu-18-04) – astentx Nov 27 '20 at 10:35

2 Answers2

0

You have to remove problematic PPA (it does no publish packages for 18.04 LTS - bionic) first with:

sudo add-apt-repository -r ppa:grass/grass-stable

and then update your package lists

sudo apt-get update

and install new updates with their dependencies by

sudo apt-get dist-upgrade

You have added R 3.5 repository (see bionic-cran35 in its URL), instead of needed R 4.0 (bionic-cran40). You have to remove wrong repository with

sudo add-apt-repository -r 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

and then add correct one:

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
sudo apt-get dist-upgrade
sudo apt-get install r-base r-base-core r-recommended
Mark dG
  • 321
  • 1
  • 13
  • Maybe his could help you then. https://stackoverflow.com/questions/61586021/is-it-impossible-to-install-r-4-0-on-ubuntu-18-04-4-lts-because-r-base-core-requ – Mark dG Nov 27 '20 at 10:20
0

In order to install the last R version in Ubuntu LTS >= 16.04. (amongst other 18.04) follow the instructions at CRAN. If you have already installed the distro version of R remove it with the package manager.

Here, I made a summarized version of the instructions. Note that this instructions are valid for any LTS. I tried them with 18.04. and worked smoothly.

  1. update indices

sudo apt update -qq

  1. install two helper packages we need

sudo apt install --no-install-recommends software-properties-common dirmngr

  1. Add the signing key (by Michael Rutter) for these repos

wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc

  1. Add the R 4.0 repo from CRAN

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"

  1. Install R and its dependences

sudo apt install --no-install-recommends r-base

  1. Ready, you can execute R by just entering R on your terminal.
loved.by.Jesus
  • 2,266
  • 28
  • 34