Error Installing R on Ubuntu 18 Broken Packages
I found what was wrong in another post... this one:
How do I restore the default repositories?
It seems some code I used from another forum just ended up messing my repositories I guess?
Sorry I asked for help when I just needed to do more research :P
So what I did was:
- run the following code:
sudo rm /etc/apt/sources.list
- then:
sudo -i software-properties-gtk
Go to software-properties-gtk
(run it in the console) and reset the repository to the one closest to me (geographically):
and then just reset the update configs to whatever suits you I guess, I put all to automatically update daily.
Then I just ran sudo apt-get intall r-base
in and it worked!
Credit to the original post I mentioned earlier.
Related videos on Youtube
Lucas X
Updated on September 18, 2022Comments
-
Lucas X over 1 year
I'm really struggling with installing R on Ubuntu 18. It's my first time with the OS... I tried looking up other questions here in the website and had no luck, even with this on that is basically my problem: Dependency errors while installing R in Ubuntu 17.10
Anyway, I tried running
sudo apt install r-base
and the response is: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 (>= 3.4.4-1xenial0) but it is not going to be installed Depends: r-recommended (= 3.4.4-1xenial0) 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.
And no instruction I've seen here or in any other site seems to correct this issue... If anyone could help me I'd be so grateful! Thanks.
-
Videonauth about 6 yearsDid you upgrade from 16.04 and where those packages while being on 16.04.x ?
-
Lucas X about 6 yearsI didn't upgrade. I had windows on this machine and then switched to ubuntu and am learning to use it properly now...
-
Videonauth about 6 yearsOr did you install any PPA for r-base? None of the packages on my 18.04 have any xenial (16.04) dependencies mentioned. Or are you on 16.04? Please edit your question to include the output of
lsb_release -a
. -
Videonauth about 6 yearsAnd you can try to use my below posted solution for a fix and tell me how it goes.
-
WinEunuuchs2Unix about 6 yearsInstall Ubuntu 16.04 instead. You should be able to use
R
reliably. Then after Ubuntu 18.04 is fixed you can upgrade. -
Videonauth about 6 years@WinEunuuchs2Unix there is nothing wrong with the r-base packages in a clean 18.04 Ubuntu installation
apt-cache show "^r-base*" | grep "*xenial*"
yields no output at all. And going manually over the output ofapt-cache show "^r-base*"
confirmed it. Those dependencies are somehow alien to an 18.04 system and im actually trying to evaluate what went wrong. -
WinEunuuchs2Unix about 6 yearsOP says there was no upgrade and it is a fresh install...
-
Videonauth about 6 yearsYes and i sit here in front of my main PC which is a fresh 18.04 as well :) and trying to reproduce this but i nowhere have dependencies listed for and package with xenial in the version number. Largely genuine bionic versin numbers end in 1ubuntu.. and not in 1xenial..
-
-
Videonauth about 6 yearsThen I will delete my answer. but I guess after cleaning up your sources.list my solution will have brought you to the proper path, so please make this a proper answer to your question :) by editing and expanding it.
-
Lucas X about 6 yearsOk, but I think I don't understand what you said at the end... I should edit my answer so that I explain that you posted a answer that would have worked but I found another solution before trying yours? Sorry, I don't often user this type of forums :P don't really know the right way to do things...
-
Videonauth about 6 yearsNo post in your answer the steps it took you to fix your system. That I was saying. Questions and answers are not only for the OP, but for people stumbling over the same mistake/problem.
-
FredTheWebGuy about 5 years-1 times infinity. DO NOT DO THIS!! These instructions are DANGEROUS and outdated. You have been warned!!
-
JiratPasuksmit over 4 yearsoh my god I already follow this to remove sources.list and it totally broke my env my god my god
-
damadam over 4 yearsThis is a duplicate of a previous answer
-
Eliah Kagan over 4 years@damadam This would benefit from editing, but as far as I can tell, it is the only answer so far that recommends adding
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
, so I don't think it's just a duplicate of (or "thanks" post about) any previous answer posted on this question.