Apt unmet dependencies while installing R on Ubuntu 16.04

13,533

Solution 1

My problem is solved.

I had put the wrong source in my sources.list to download the latest version of R. Following the instructions given in https://cloud.r-project.org/, I had put deb https://cloud.r-project.org/bin/linux/ubuntu cosmic-cran35/ instead of deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/.

By modifying the source, everything works fine now.

Solution 2

So here is how to install R 3.6 on your current Ubuntu distribution, without having to manually adjust the distribution name or

sudo apt-get update
sudo apt-get install -y apt-transport-https software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

# this will define the DISTRIB_* environment variables
source /etc/lsb-release

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu ${DISTRIB_CODENAME}-cran35/"

# for 18.04, bionic beaver, this resolves to
#sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
# for 16.04, xenial, this resolves to
#sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'

sudo apt-get update
sudo apt-get install -y r-base r-base-dev
R --version
Rscript --version

This should eliminate the error messages that arise from you choosing the wrong distribution like:

 The following packages have unmet dependencies.  
 r-base-core : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11 is to be 
               installed  
               Depends: libcurl4 (>= 7.28.0) but it is not installable  
               Depends: libicu60 (>= 60.1-1~) but it is not installable  
               Depends: libreadline7 (>= 6.0) but it is not installable  
               Recommends: r-base-dev but it is not going to be installed  

Inspired by

Share:
13,533

Related videos on Youtube

Akusa
Author by

Akusa

Updated on September 18, 2022

Comments

  • Akusa
    Akusa over 1 year

    I wanted to install the new R version so I did a purge by removing all r-*. And then I broke everything unfortunately. I try to reinstall R project by typing

    sudo apt install r-base r-base-core r-recommended
    

    and then I obtain

    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-core : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11 is to be 
                   installed  
                   Depends: libcurl4 (>= 7.28.0) but it is not installable  
                   Depends: libicu60 (>= 60.1-1~) but it is not installable  
                   Depends: libreadline7 (>= 6.0) but it is not installable  
                   Recommends: r-base-dev but it is not going to be installed  
    E: Unable to correct problems, you have held broken packages.
    

    Does anyone know how to solve this ?

  • Akusa
    Akusa about 5 years
    I added the wrong source in my sources.list. Instead of putting the xenial one, I put the cosmic one. By correcting this, everything seems to work now !
  • Akusa
    Akusa about 5 years
    @Melebius Done !
  • masterxilo
    masterxilo over 4 years
    for the record: 16.04 === xenial, 18.04 === bionic, 18.10 === cosmic
  • Laurence_jj
    Laurence_jj almost 3 years
    sorry, but it doesn't work