I'm trying to install the R programming language on Zorin OS 16.3 Lite (the one with the xcfe desktop). I've been following the official installation instructions (linked below).
When I run
sudo apt-get install r-base
I get the following output:
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 (>= 4.3.1-4.2204.0) but it is not going to be installed
Depends: r-recommended (= 4.3.1-4.2204.0) 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.
After some troubleshooting I'm pretty sure there's a dependency problem with r-base-core. Running
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.35) but 2.31-0ubuntu9.9 is to be installed
Depends: libicu70 (>= 70.1-1~) but it is not installable
Recommends: r-base-dev but it is not going to be installed
Recommends: r-doc-html but it is not going to be installed
r-recommended : Depends: r-cran-mgcv (>= 1.1.5) but it is not going to be installed
Depends: r-cran-nlme (>= 3.1.52) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
libc6 2.35 or greater is required, but my system has 2.31 installed. According to a thread on this forum (Update "libc6" to version 2.34 or newer), updating libc6 isn't really an option. I really need to get this package working as soon as possible. How should I proceed?
That's a bit of a sticky situation, and it's been on-going for years.
Don't just install libc6 2.35 alongside 2.31... it'll crash your system, most likely. You have to change the path of 2.35 (put it somewhere else than default), then change the path in the R programming language so it references that 'somewhere else'. That's a lot of work, and you don't have to do it.
Thank you so much for responding. I've added the cran2deb repository and checked the launchpad page (cran2deb4ubuntu 4.0 : “cran2deb4ubuntu Build Team” team), but there are a few thousand packages listed and I'm not sure which one I need. From what I can tell most of them are libraries or addons for R
Here is your trouble. You have Bionic and Jammy sources added in addition to Focal.
These are different versions and they will call on different dependencies.
Please stick only with Focal (Fossa) repositories on Zorin OS 16.
Remove the two troublesome repositories either by using the Software & Updates app or by elevating to root and navigating to /etc/apt/sources.list.d directory to find and remove them.
You must keep the ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal InRelease repository as it is correct.
Once done, run sudo apt update to get your sources updated to the existing repositories on your system. You might run sudo apt clean && sudo apt autoremove just to give yourself a bit more peace of mind.
$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 https://packages.zorinos.com/stable focal InRelease
Hit:5 https://packages.zorinos.com/patches focal InRelease
Hit:6 https://packages.zorinos.com/apps focal InRelease
Hit:7 https://packages.zorinos.com/drivers focal InRelease
Hit:8 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:9 http://ppa.launchpad.net/bartbes/love-stable/ubuntu focal InRelease
Hit:10 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal InRelease
Hit:11 http://ppa.launchpad.net/easymodo/qimgv/ubuntu focal InRelease
Hit:12 http://ppa.launchpad.net/zorinos/apps/ubuntu focal InRelease
Hit:13 http://ppa.launchpad.net/zorinos/drivers/ubuntu focal InRelease
Hit:14 http://ppa.launchpad.net/zorinos/patches/ubuntu focal InRelease
Hit:15 http://ppa.launchpad.net/zorinos/stable/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
$ sudo apt install r-base
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-recommended (= 3.6.3-2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
apt install r-recommended told me that it had a dependency on r-cran-foreign. apt install r-cran-foreign said it had a dependency on r-base-core. apt install r-base-core worked, but apt install r-base gives, the same error as before. r-cran-foreign now says there's a version problem:
$ sudo apt install r-cran-foreign
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-cran-foreign : Depends: r-base-core (>= 4.0.0-1.2004.0) but 3.6.3-2 is to be installed
Depends: r-api-4.0 but it is not installable
E: Unable to correct problems, you have held broken packages.
Glad to hear. I went ahead and moved the Solution mark to @Mr_Magoo 's initial post due to that post containing the suggested solution - everything that followed just needed to straighten out repositories for that solution to work.