0

I have been trying for days now. I would like to upgrade to the latest version of R. I have followed advice found on this link : Problem installing R4.0 on LInux Mint 19.3

but for me the problem persists for me. When I do

echo -e "\ndeb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/" | sudo tee -a /etc/apt/sources.list
then
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

sudo apt-get install r-base

I get this

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 (= 4.0.5-1.1804.0) but it is not going to be installed
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (en_US) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
E: Unable to correct problems, you have held broken packages.

If anyone has an idea of how to solve this I would be eternally grateful.

r2evans
  • 141,215
  • 6
  • 77
  • 149
CaroZ
  • 9
  • 1
  • Not sure if it is the over-arching problem, but it looks like you have duplicate entries in your `/etc/apt/sources.list`. If they are configured for similar repos but just a little different, I wonder if it could be introducing conflicts. FYI, I prefer to add personal (per-site) deb-package repos within individual files in `/etc/apt/sources.list.d/` instead of the master `sources.list` files; it seems more straight-forward to maintain, and keeps things nicely separated. – r2evans Apr 21 '21 at 13:08
  • I suspect that the *"you have held broken packages"* is a concern, as well. I'm not proficient-enough on dealing with broken/incomplete/held packages, but look at `dpkg -l | grep -Ev '^(ii|rc)'` to see if something stands out. – r2evans Apr 21 '21 at 13:09
  • After checking r2evans comments, try these instructions https://cloud.r-project.org/bin/linux/ubuntu/ – M.Viking Apr 21 '21 at 13:21
  • Oh yes indeed I do have duplicate entries in /etc/apt/sources.list I think I need this one deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ but I have both the aforementioned and the former one which was deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ – CaroZ Apr 21 '21 at 13:23
  • I indeed tried following the instructions here cloud.r-project.org/bin/linux/ubuntu when I reach ~$ apt install --no-install-recommends software-properties-common dirmngr I get software-properties-common is already the newest version (1.8.4). dirmngr is already the newest version (2.2.4-1ubuntu1.4). 0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded. – CaroZ Apr 21 '21 at 13:39
  • ... and when finally I do ~$ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/" I get Malformed input, repository not added. – CaroZ Apr 21 '21 at 13:43
  • I corrected it by hand in the source.list file, then ran apt install --no-install-recommends r-base and once again, it just installed the old version of R I already had. Which is better than nothing I suppose : R version 3.4.4 (2018-03-15) -- "Someone to Lean On" – CaroZ Apr 21 '21 at 13:57

2 Answers2

0

W: Target Translations (en_US) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7

Remove the duplicate entry in your sources (line 5 and 7):

sudo sed -i '7d' /etc/apt/sources.list

The following packages have unmet dependencies: r-base : Depends: r-recommended (= 4.0.5-1.1804.0) but it is not going to be installed

Use the following command:

sudo apt update
sudo apt install --no-install-recommends r-base
GAD3R
  • 4,317
  • 1
  • 23
  • 34
0

This post:

https://unix.stackexchange.com/a/612316/367012

Says Mint is different than Ubuntu in adding repositories, and suggests manually editing the repository list,

$ sudo xed /etc/apt/sources.list.d/additional-repositories.list

to add:

deb cloud.r-project.org/bin/linux/ubuntu bionic-cran40/

Save and exit the editor, then update the package list:

$ sudo apt update

This post: https://askubuntu.com/a/1113944/968912 suggests removing all the previous versions of R first.

M.Viking
  • 5,067
  • 4
  • 17
  • 33
  • Yes I have done both already, thank you very much for this link ! – CaroZ Apr 22 '21 at 10:48
  • Are you able to install R 4, or do you have updated error messages. One thing not mentioned is, after all these edits and installations, try turning it off and back on again :) another is `$ sudo apt update` needed to be run after editing the repo list. – M.Viking Apr 22 '21 at 11:50
  • 1
    Turning in off and on again is by far the best approach, which is why I did it 953 times. I had trouble with installing devtools, which I solved (I hope ?) by running sudo apt-get install libcurl4-openssl-dev --fix-broken I just ran sudo apt update again, my terminal tells me there are 25 packages which can be updated, so I ran apt list --upgradable : – CaroZ Apr 23 '21 at 12:37
  • 1
    which tells me things like these : libgl1-mesa-dri/bionic-updates 20.0.8-0ubuntu1~18.04.1 i386 [upgradable from: 19.0.8-0ubuntu0~18.04.1] ...plus some R packages which can be upgraded. – CaroZ Apr 23 '21 at 12:44