1

This question already has an answer here:

I tried to install R on my Ubuntu 16.04 LTS. However, I have errors that I can not solve for several hours. I first tried to install the bionic version and after the xenial version. Both methods produced the same errors. I do not know which one to use, it's confusing for me. I followed this procedure to install it.

sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list 
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get install r-base r-base-dev

When I execute sudo apt-get install r-base r-base-dev, I get the following errors :

sudo apt install r-base r-base-dev
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.5.2-1bionic) but it is not going to be installed
          Depends: r-recommended (= 3.5.2-1bionic) but it is not going to be installed
          Recommends: r-base-html but it is not going to be installed
 r-base-dev : Depends: r-base-core (>= 3.5.2-1bionic) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have tried several solutions on different topics but they have no effect on the problem.

Thank you in advance for your help.

marked as duplicate by N0rbert, karel, Eric Carvalho, Fabby, Elder Geek Feb 13 at 18:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    It looks like you have some bionic (18.04) repositories in your /etc/apt/sources.list or /etc/apt/sources.list.d files – steeldriver Feb 11 at 14:08
  • Thank you but what should I do with that ? Delete these lines from the source.list file ? – Simon Feb 11 at 14:33
  • TBH I don't know the best way forward - if there are already packages installed from the "wrong" distribution it may be hard to unscramble without breaking other stuff – steeldriver Feb 11 at 14:37
  • Perhaps upgrading to 18.04 LTS would solve this problem. – Jos Feb 11 at 14:52
  • I solved the problem by commenting all lines in the sources.list file containing the bionic name (in my file : 2 lines). After that I executed the sudo apt-get install r-base r-base-dev and no problem occurred. The problem is solved ! – Simon Feb 11 at 15:32