1

I'm trying to install R 4.0 on Ubuntu, but get this error:

$ sudo apt-get 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 (>= 4.0.0-1.2004.0) but it is not going to be installed
          Depends: r-recommended (= 4.0.0-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.

I have run these commands to set up apt to receive R 4.0, as recommended at https://cran.r-project.org/bin/linux/ubuntu/README.html:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
    sudo apt-get update

What am I doing wrong, and how can I fix it?

I did have R 3.4 installed on this system before, and removed it with

sudo apt-get remove r-*
sudo apt-get purge r-*

Have I screwed something up by doing that?

futuraprime
  • 5,468
  • 7
  • 38
  • 58
  • Today, I stumbled across this blog post, but don't know if it's of any help: https://rtask.thinkr.fr/installation-of-r-4-0-on-ubuntu-20-04-lts-and-tips-for-spatial-packages/ – hplieninger May 19 '20 at 14:32

1 Answers1

1

The error was, it turned out, entirely mine:

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

added the repo for Ubuntu 20.04. I needed:

    sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
futuraprime
  • 5,468
  • 7
  • 38
  • 58
  • Did you manage to get R 4.0.1 installed on Ubuntu 18.04? In my case it instals only R 3.4.4 as the latest version. I have added the correct line `deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/` in `/etc/apt/sources`. What could be wrong? – Lazarus Thurston Jun 17 '20 at 04:58
  • @futuraprime: how did you remove the repo (focal-cran40)? Edit: what worked for me was to manually remove the ppa, shown here: https://ostechnix.com/how-to-delete-a-repository-and-gpg-key-in-ubuntu/ – Chintan Pathak Oct 27 '20 at 21:06