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.)