8
votes

Hello I am trying to install r-base for Ubuntu 16.04.

I have followed the steps at https://cran.r-project.org/bin/linux/ubuntu/README.html

However I am getting a 'unmet dependencies' error when I run sudo apt-get install r-base

The following packages have unmet dependencies: r-base : Depends: r-recommended (= 3.4.4-1xenial0) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

Any ideas for getting around this? Thanks in advance!

3
What happens if you do sudo apt-get install r-base r-recommended?Maurits Evers
I get a similar 'unmet dependencies' error regarding r-recommended with a list of 7 missing dependencies.dobis32
Have you tried sudo apt --fix-broken install followed by sudo apt-get update followed by sudo apt-get upgrade?Maurits Evers
It appears to be working! Thank you so much!dobis32

3 Answers

2
votes

Running the following commands seems to have solved my problem:

sudo apt --fix-broken install
sudo apt-get update
sudo apt-get upgrade
1
votes

Running the following fixed it for me, but this solution uses r-base-dev not r-base (r-base still didn't work).

sudo apt --fix-broken install
sudo apt autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base-dev

Make sure to check in the software and properties that if your restricted and universe repositories are enabled. Here's a link with more information.

1
votes

I started getting this issue because I added the wrong apt-repository for my version of Ubuntu (focal fossa instead of bionic).

Solved by doing sudo vim /etc/apt/sources.list, then deleting any lines containing focal