Ubuntu – Updating R 3.5.3 to R 4.0.2 on Ubuntu 18.04

18.04repositoryupdatesupgrade

I have been trying to move from this version for a while, however all attempts have failed.
The steps I am following:

sudo apt-get remove r-base r-base-dev
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

output:

Err:13 http://ppa.launchpad.net/grass/grass-stable/ubuntu bionic Release     
404  Not Found [IP: 91.189.95.83 80]

after:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 

output:

--recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: clave 51716619E084DAB9: "Michael Rutter <marutter@gmail.com>" sin cambios
gpg: Cantidad total procesada: 1
gpg:              sin cambios: 1

after:

sudo apt update

output:

Err:13 http://ppa.launchpad.net/grass/grass-stable/ubuntu bionic Release     
404  Not Found [IP: 91.189.95.83 80]

after:

sudo apt install r-base r-base-core r-recommended

output:

r-recommended : Depende: r-cran-boot (>= 1.2.19) pero no va a instalarse
             Depende: r-cran-cluster (>= 1.9.6-2) pero no va a instalarse
             Depende: r-cran-foreign (>= 0.7-2) pero no va a instalarse
             Depende: r-cran-mgcv (>= 1.1.5) pero no va a instalarse
             Depende: r-cran-rpart (>= 3.1.20) pero no va a instalarse
             Depende: r-cran-survival (>= 2.13.2-1) pero no va a instalarse
             Depende: r-cran-mass pero no va a instalarse
             Depende: r-cran-class pero no va a instalarse
             Depende: r-cran-nnet pero no va a instalarse
             Depende: r-cran-codetools pero no va a instalarse
             Depende: r-cran-matrix pero no va a instalarse

Best Answer

  • You have to remove problematic PPA (it does no publish packages for 18.04 LTS - bionic) first with:

    sudo add-apt-repository -r ppa:grass/grass-stable
    

    and then update your package lists

    sudo apt-get update
    

    and install new updates with their dependencies by

    sudo apt-get dist-upgrade
    

    You have added R 3.5 repository (see bionic-cran35 in its URL), instead of needed R 4.0 (bionic-cran40). You have to remove wrong repository with

    sudo add-apt-repository -r 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
    

    and then add correct one:

    sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
    sudo apt-get dist-upgrade
    sudo apt-get install r-base r-base-core r-recommended