3

We followed instructions here - https://rtask.thinkr.fr/installation-of-r-4-0-on-ubuntu-20-04-lts-and-tips-for-spatial-packages/ - to uninstall R:

sudo apt-get purge r-base* r-recommended r-cran-*
sudo apt autoremove
sudo apt update

...seems to have worked because when we run R in command line we get -bash: /usr/bin/R: No such file or directory. However, when we try to install R using:

apt install --no-install-recommends r-base

...version 3.6.3 is installed, not version 4.0 or 4.1. Here is our machine type.

enter image description here

What can we do to get R version 4.1.0 (preferred) installed on our machine? I am worried that, perhaps it is not possible as if it were, v4 would be the default rather than v3... might it be the case that 16.04 is too old for R v4?

Edit: followed the instructions in the comment below, but ran into the following issue:

enter image description here

enter image description here

Canovice
  • 9,012
  • 22
  • 93
  • 211
  • 3
    According to https://cran.rstudio.com/bin/linux/ubuntu/ Xenial Xerus (16.04; LTS) is compatible with R v4.1 - perhaps try the instructions on that page – jared_mamrot Sep 17 '21 at 05:30
  • yes i believe so. sudo apt-mark showhold is empty as well, per - https://askubuntu.com/questions/363200/e-unable-to-correct-problems-you-have-held-broken-packages - I hoped this may reveal where the issue is but it did not – Canovice Sep 17 '21 at 05:45
  • can i simply install r-base-core and r-recommended? – Canovice Sep 17 '21 at 05:47
  • 1
    I don't know - I can't say whether it will work or not - if it was me, I would give it a shot, but it may result in having to delete everything and starting everything from scratch – jared_mamrot Sep 17 '21 at 05:49
  • I dont mind reinstalling libraries – Canovice Sep 17 '21 at 05:51
  • so i have managed to completely mess this up as now I can not install any versions of R... – Canovice Sep 17 '21 at 05:54
  • 1
    Have you considered installing docker and then R through rocker/r-base? – Waldir Leoncio Sep 17 '21 at 05:56
  • no i have not considered this. I am not a devops expert or particularly strong with Docker. We just need R working on this linux server and I had simply hoped it would be easier to upgrade from 3.6 to 4.1... – Canovice Sep 17 '21 at 05:57
  • 1
    Argh - sorry! That's frustrating! I'm booting up a xenial VM now to see if I can help troubleshoot the issue. When you delete/purge everything, don't forget about the gpg key in /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc – jared_mamrot Sep 17 '21 at 05:57
  • at this point i'd be happy to delete/purge everything and reinstall R from scratch, but this `E: Unable to correct problems, you have held broken packages.` is blocking me from doing anything – Canovice Sep 17 '21 at 05:58
  • you think I should also remove `trusted.pgp` and `trusted.gpg~` in addition to `/etc/apt/trusted.gpg.d/cran_ubuntu_key.asc` – Canovice Sep 17 '21 at 06:00
  • 2
    Have you tried `sudo apt --fix-broken install && sudo apt autoremove && sudo apt-get update && sudo apt-get upgrade && sudo apt-get install r-base-dev` ([Ref](https://silvae86.github.io/2019/04/02/fix-broken-package-r-language-install/))? – jay.sf Sep 17 '21 at 06:04
  • at this point this is a whole new question, so i feel like a separate question thread may be appropriate? - https://stackoverflow.com/questions/69218469/cannot-install-r-unable-to-correct-problems-you-have-held-broken-packages – Canovice Sep 17 '21 at 06:05
  • @jay.sf just ran this, still receiving `The following packages have unmet dependencies: r-base-dev : Depends: r-base-core (>= 4.1.1-1.2004.0) but it is not going to be installed` - it does seem like some of the other "unmet depepdencies" are no longer appearing, which I think is good. but still getting this error – Canovice Sep 17 '21 at 06:06
  • this only started happening after running the 4 commands here - cran.rstudio.com/bin/linux/ubuntu - perhaps I can undo these commands? – Canovice Sep 17 '21 at 06:14
  • 1
    Related: https://stackoverflow.com/q/65035038/6574038 and https://stackoverflow.com/q/61586021/6574038 and https://stackoverflow.com/a/16093367/6574038 and https://askubuntu.com/a/436491 – jay.sf Sep 17 '21 at 06:19
  • thanks. I'm going to rest on this before I throw my laptop into a wall, and will take a look at these tomorrow. appreciate the help big time – Canovice Sep 17 '21 at 06:22
  • 1
    I've run into the same issue ("Unable to correct problems, you have held broken packages.") with an ubuntu 16.04 VM - i'll try a bunch of stuff and post what I find – jared_mamrot Sep 17 '21 at 06:25
  • Thanks. I just feel like I'm just throwing mud at the wall right now, hoping something will stick – Canovice Sep 17 '21 at 06:26
  • 1
    @Canovice I can't remember the exact steps I've taken, but I've overcome exactly the same issue while installing R>4 on a Raspi. So it should be possible, the information is spread across the internet though. Perhaps try searching for _linux_ instead of _ubuntu_. Good luck, and please share your solution once you found it. – jay.sf Sep 17 '21 at 06:32
  • 1
    I've gotten nowhere with the VM. Even trying to install other packages (e.g. 'curl') throws up dependency issues - something is broken somewhere - sorry I couldn't help with your problem – jared_mamrot Sep 17 '21 at 07:07
  • @jared_mamrot ive simply reverted to a backup of our server from before this mess up. I will try again updating to r v4 in the future – Canovice Sep 17 '21 at 14:27

0 Answers0