I have this version of Ubuntu

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic

on my computer in a dual boot with Windows.

I have tried to install R following this tutorial https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04 and I got the following error:

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.2-1bionic) but it is not going to be installed
          Depends: r-recommended (= 3.6.2-1bionic) 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.

To fix the error I followed this answer https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa but none of the proposed solution works.

In partcular, even if my sudo apt-get -f install returns 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded., if I try again sudo apt install r-base it's still not working


I had a similar problem today, and I found my solution, so I thought I would share my experience with you.

I needed to update to r 3.6 and I'm on ubuntu 18. I started by removing R. I used

sudo apt remove r-base. 

R 3.4 was removed from my machine, but old dependencies were left behind. When I added the new repository per the instructions on digitalocean https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04-quickstart I got your same error after typing

sudo apt install r-base

The issue was the old dependencies. I ran this command to fix the issue

sudo apt-get -u dist-upgrade

I hit "Y" to approve removing the old dependencies and to approve installation of the new ones. *****The key to this is to close this terminal after it finishes, and open a new terminal before trying to install R again. Keep in mind, when you make system changes like this, they aren't immediately implemented in your terminal, so even after you fix the problem, the fix is not applied to your current terminal. So, just open a new terminal and then try to install R.

Good Luck!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.