I am trying to install R on an Ubuntu 18.04 machine and am encountering an "unmet dependencies" problem. However, I am unable to determine where I can go or what I need to fix on my system to overcome this. Any help would be greatly appreciated.
I am running Ubuntu 18.04.2 LTS (with 16Gb RAM and 500Gb hard disk), using just the standard bionic
repositories; the only PPA i've added is that for libreoffice. To see what's there, the output to sudo apt update
is
Ign:1 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://dl.google.com/linux/chrome-remote-desktop/deb stable Release
Hit:4 http://dl.google.com/linux/chrome/deb stable Release
Get:7 https://desktop-download.mendeley.com/download/apt stable InRelease [2,456 B]
Get:8 https://typora.io/linux ./ InRelease [758 B]
Hit:9 http://repository.spotify.com stable InRelease
Hit:10 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
Hit:11 http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic InRelease
Hit:12 http://sg.archive.ubuntu.com/ubuntu bionic InRelease
Hit:13 http://sg.archive.ubuntu.com/ubuntu bionic-backports InRelease
Get:14 http://sg.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 91.9 kB in 3s (26.5 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
(I try to keep things in sync as much as possible and run sudo apt update && sudo apt upgrade
at least once every two days.)
When I attempt to install the first of R's components r-base
(via sudo apt install r-base
) I get the following unmet dependencies:
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.4.4-1ubuntu1) but it is not going to be installed
Depends: r-recommended (= 3.4.4-1ubuntu1) 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.
Running software-properties-gtk
, I see that all repositories are enabled. Running sudo apt-get clean
and sudo apt-get autoclean
proceeds to completion with no error messages. When I execute
$ sudo apt-get -f install
$ sudo dpkg --configure -a
$ sudo apt-get -f install
the output is
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
so there seems to be no held or conflicted or broken packages on my system. I have also executed sudo apt --fix-broken install
, but again, as above, my system seems to have no held or broken packages.
Running sudo apt-get dist-upgrade
shows
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I'm happy to try anything else someone might want to suggest to see if the fault remains on my system.
Next I add
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
to my /etc/apt/sources.list
and run
$ sudo apt update
$ sudo apt install r-base
Still no joy; the output is now (omitting repeats from above)
The following packages have unmet dependencies:
r-base : Depends: r-base-core (>= 3.6.0-2bionic) but it is not going to be installed
Depends: r-recommended (= 3.6.0-2bionic) 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.
(but at least I've moved from 3.4.4-1ubuntu1
to 3.6.0-2bionic
.) Repeating the sudo apt-get -f install ; sudo dpkg --configure -a; sudo apt-get -f install
sequence above continues to show
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
so again there seems to be no held or conflicted packages otherwise.
The output from apt-cache policy r-base
is:
Installed: (none)
Candidate: 3.6.0-2bionic
Version table:
3.6.0-2bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.6.0-1bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.5.3-1bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.5.2-1bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.5.1-2bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.5.1-1bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.5.0-1bionic 500
500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
3.4.4-1ubuntu1 500
500 http://sg.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
500 http://sg.archive.ubuntu.com/ubuntu bionic/universe i386 Packages
I'm not sure, however, where to go dig further or what files to adjust based on this output.
Are there locations I need to add to my /etc/apt/sources.list
to put in place the dependencies on r-base-core
and r-recommended
? Where else do I need to go to get them? The linux installation page
https://cran.ma.imperial.ac.uk/bin/linux/ubuntu/README.html
does not suggest to me anything further to add to my /etc/apt/sources.list
. Google returns a whole bunch of other things including marutter
's PPA and I've experimented with adding those into my sources, but none has allowed me to install to completion. [Yes, when I've removed them, I've made sure to run through clean
and autoclean
each time, as above.]
To be clear, I am not obsessed about having the absolutely latest version of R/ I'd be happy with anything else slightly out-dated too, but I don't see any hint on the linux installation page for R what I might adjust.
(On my other machines, GalliumOS 2.1 and GalliumOS 3.0, I have installed R and RStudio, no issues. )
Any help would be greatly appreciated.
(This problem has now been solved as described below; I had two slightly inconsistent versions of packages. I ended up removing both and re-installed just one.)
sudo apt update
. This is one easy way to see all your sources in one print. – user535733 May 23 '19 at 12:47'universe' distribution component is already enabled for all sources.
– Danny Quah May 23 '19 at 13:02sudo apt-get dist-upgrade
and add error output to the question (if any). – N0rbert May 23 '19 at 13:03sudo apt-get dist-upgrade
shows[09:01 PM xbook ...tc/apt]$ sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
– Danny Quah May 23 '19 at 13:05apt-cache policy
on the troublesome packages, and following that trail until you find the version conflict. It's slow, but sure. Looks to me like you don't have a missing source; looks like you have a version conflict somewhere. – user535733 May 23 '19 at 13:06apt-cache policy
sounds hopeful; I'd tried it previously but wasn't sure how to follow up with it. I still don't know whether it's R end or my system that needs to be augmented, so any help would be appreciated. Will edit my question to include this. – Danny Quah May 23 '19 at 13:10apt-cache policy r-base
, and post the complete output into your question. – user535733 May 23 '19 at 13:12sudo apt install r-base-core r-recommended --simulate
and see which one fails. Then let's look at the failure. – user535733 May 23 '19 at 13:18libquadmath0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.3.0-6ubuntu1~18.04 is to be installed
but when I query forgcc-8-base
what I'm told isgcc-8-base is already the newest version (8.3.0-6ubuntu1~18.04). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I'm told this is where the buck stops but it shouldn't as I've already got the newest version? – Danny Quah May 23 '19 at 13:24apt-cache policy gcc-8-base
to see which sources the two different versions are coming from. – user535733 May 23 '19 at 13:27apt-cache policy gcc-8-base
, I getgcc-8-base: Installed: 8.3.0-6ubuntu1~18.04 Candidate: 8.3.0-6ubuntu1~18.04 Version table: *** 8.3.0-6ubuntu1~18.04 100 100 /var/lib/dpkg/status 8-20180414-1ubuntu2 500 500 http://sg.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Grateful for how I go from here to what I do next? – Danny Quah May 23 '19 at 13:29sudo apt update
to refresh your package database (since your sources have changed). This will solve the gcc-8-base problem - there might be others we don't know about yet. You had a different problem before adding the non-Ubuntu cran repo, and we haven't looked at that yet. It's your system, so it's entirely your decision. – user535733 May 23 '19 at 13:37ppa-purge
tool can be very convenient for this kind of work. – user535733 May 23 '19 at 15:54