Upgrading r-base from v3.6 to v4.0 Linux - r

I am trying to install R-base 4.0, but it keeps installing v3.6. I've tried:
sudo apt install deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
sudo apt-get install r-base
and v3.6, not 4.0 was installed. Next I tried:
sudo apt install deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/
sudo apt-get upgrade r-base
and it didn't work.
How do I upgrade to Rv4.0? I am using Pop_Os, no Ubuntu. Could that be the issue?

First off, your initial line is wrong. There is not such apt install deb command. You are supposed to edit the apt sources file by hand (though these days there may be GUI solutions to it as well).
Second, you omitted to actually use the new repo by not running sudo apt update (or equally sudo apt-get update). You must update the local indices.
Third, a preferred way is to just upgrade as you (almost) did in the second paragraph. But upgrade takes no package argument!
Fourth, this has nothing to do with Pop!OS as we are talking only about apt and apt-get here.
For completeness, I did a little blog and video about the R 3.6.* to R 4.0.* upgrade. More info here if you care.
PS Fifth, as r2evans noted in the comment, be sure to pick the right distro. I run straight Ubuntu so "focal" it is more me. You probably want R 4.0.* from the Ubuntu build matching your Pop!OS build.

Related

Installing R 4.1 from source on newly installed Ubuntu 20.04

I tried to install R 4.1 on a newly set-up Ubuntu 20.04. After some struggle with the repositories and keys, I chose to install from source.
Visited https://www.r-project.org/ to download latest version of R. Ran ./configure multiple times to note the requirement of various libraries which you may note as follows. I am hoping this will save significant amount of time for anyone intending to build from source. Suggestions welcome for speeding up the process or better solution. However my intention is to share entire set of libraries that I had to install on a naked installation of 20.04 on which the very first package I tried to install was R 4.1 (from source).
Directory where you downloaded the tar.gz (e.g. R-4.1.2.tar.gz in my case)
cd Downloads
Untar
tar -xvzf R-4.1.2.tar.gz
Enter directory
cd R-4.1.2
As root
sudo su
Try validating configuration (encountered many errors throughout and following libraries were installed)
./configure
Installed various libraries:
apt-get install build-essential
apt-get install gfortran
apt-get install fort77
apt-get install libreadline-dev
apt-get install xorg-dev
apt-get install liblzma-dev libblas-dev
apt-get install gcc-multilib
apt-get install libbz2-dev
apt-get install libpcre2-dev
apt-get install libcurl4-openssl-dev
apt install default-jdk
make
make install
The above set worked for me and I am hopeful it may be of help.

Cannot install R - Unable to correct problems, you have held broken packages

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.
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:

Linux Mint 19 Terminal refuses to add repository despite giving correct source for R3.5 installation files

I have to install the latest version of R on my Linux Mint 19 computer in order to run some bioinformatics tools (Biostrings). I then followed this website for the tutorial (I suppose things are not very different with Mint or Ubuntu after all). However, after I typed in the third command line into the Terminal, which is
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
it replied
Malformed input, repository not added.
Now I understood that there is a typo in the command on the website, and I myself corrected it to
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu/bionic-cran35/'
However, the problem still exists.
Could anyone help me with this issue?
sudo nano /etc/apt/sources.list.d/additional-repositories.list
then add the following line
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
then,
sudo apt update

How to upgrade R in linux?

I am new to Linux. I am using Linux mint 18.1. I have installed R using system software manager. My current R version is 3.2. But I want to upgrade it to version 3.4.
How can I do it?
Note: I now keep on GitHub (here) an up-to-date guide to upgrading R on Linux Mint or Ubuntu Linux, which also includes a bit of extra information about system dependencies for tidyverse, the popular set of data-wrangling packages, as well as devtools, the popular R package development... package.
The link provided by FedRo is a good resource, however a slight change would need to be made since you're using Linux Mint 18.1 which uses Xenial repositories rather than Trusty repositories (see here). I also typically use the approach here to deal with packages I've already installed when I upgrade R rather than the approach offered by FedRo. So, for completeness, these are all the steps you'd need to take:
Step 1
Go to CRAN's list of mirrors and find the URL of the mirror that is closest to you. The terminal commands below assume you choose http://cran.wustl.edu/
Step 2
Open a terminal and enter the following commands1 (replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1):
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt upgrade r-base r-base-dev
sudo apt update
sudo apt upgrade
Note also that I have put to upgrade r-base and r-base-dev, but I don't know if you have r-base-dev installed. If not, I highly recommend you install it via sudo apt install r-base-dev.
Step 3
Start a new R session and run the following:
update.packages(checkBuilt=TRUE, ask=FALSE)
Then you should be good to go.
Update: Linux Mint 19 and R 3.6.x
Since both Linux Mint and R have seen upgrades since I answered this question, I'm updating for those who come to this answer needing the info for Linux Mint 19 and R 3.6.x.
The only difference is that instead of the command
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
you need to use
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu bionic-cran35/" | sudo tee -a /etc/apt/sources.list
(replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1)
1 I put here the full key, though many other guides you may see will use only the "short key."
I have updated this guide to use the full key out of security concerns (see here, for example).
Now it is very simple. Just make:
install.packages("ropenblas")
ropenblas::rcompiler()

Install R latest verison on ubuntu 16.04

So I tried to install R (after repairing ubuntu on my system) using following command :
sudo apt-get install r-base-core
sudo apt-get install r-recommended
It installs R 3.2 , but the latest version of R currently available to use is R 3.4, any idea why it is not installing R 3.4 ?
I lately installed R.3.4 manually, it works fine. just curious to know why it didn't installed at the first place using the command.
Follow these steps:
Add this entry deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file.
Run this command in shell: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9.
Update and install: sudo apt update; sudo apt install r-base.
I wrote a post that explains each step in detail (update: also covers installing R on Ubuntu 18.04); here's the link.
It installs 3.2 because that's the default in the Ubuntu 16.04 repository. If you want the most up to date version of R for Ubuntu it's best to follow the instructions at the cran page for R on Ubuntu.
The xenial-cran35/ version of the repo does NOT work if you have a "default release" set in apt, as is the case in some distros that work on top of Ubuntu, such as Mint. For my Mint distro, there exists a file /etc/apt/apt.conf.d/01ubuntu inside of which it declares the Default-Release "xenial"; What this means is that, since r-base exists in the ubuntu repo at version 3.2, with release "xenial", it'll never use the 3.6 branch from the other repo, because the release name for that repo is "xenial-cran35". You need to edit that file to change the default release to "xenail-cran35", or do something more pointed using apt preference files (https://wiki.debian.org/AptPreferences#A.2Fetc.2Fapt.2Fpreferences).
This is basically R's fault for having a poorly formatted repo. They should have had 2 repos, each of which had a "xenial" release folder, one url for their 3.2 branch work and one for the 3.5+ branch work. Instead they have one repo, and have bastardized the "release name" instead, which just sort of happens to work for base Ubuntu, but won't work if you have non-base configuration of apt in this way.

Resources