7

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 ?

Pablo Bianchi
  • 15,657
Akusa
  • 301
  • You have held-broken packages. Fix this first (ie. try sudo apt -f install & explore anything it reports, I would fix those first). I'd also view the apt logs to see what you removed with your first listed command, and use that as a guide on fixing your system. I'd suggest closely avoiding using wildcards on remove commands unless you closely scrutinize what's being removed – guiverc Mar 13 '19 at 22:37
  • 1
    A quick look at the 16.04 repo reveals that the versions of the lib dependencies that are attempting to be installed are not part of the standard 16.04 distribution so they're not available. Is it possible you're trying to install a newer version of R still such that the dependencies can't be met on your Ubuntu distro as is? https://packages.ubuntu.com/en/xenial/libs/ – Steve Mar 13 '19 at 22:40
  • 2
    Ok, I'm dumb. I found out that I put the wrong source in my sources.list. I 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/. Thank you ! – Akusa Mar 13 '19 at 22:57

3 Answers3

13

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.

Akusa
  • 301
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

masterxilo
  • 125
  • 7
0

Try this:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libc6 libcurl4 libicu60-dev libreadline7
sudo apt-get install r-base r-base-core r-recommended