How to upgrade R version in ubuntu?
1
1
Entering edit mode
4.2 years ago
jomagrax ▴ 40

Hi everyone!

Im running a pipeline that requires a R (>= 3.6.0) while I have installed (R 3.2.2). Now, with sudo apt-install r-base i apparently install the correct version, but everytime i call R with R command, the 3.2.2 version It´s called. I've tried reinstalling but It doesn´t work either. Any ideas?

Thanks in advance, Jose

R software error • 3.8k views
ADD COMMENT
0
Entering edit mode

what is the output of:

echo $PATH

and

which -a R
ADD REPLY
1
Entering edit mode
$ echo $PATH
/home/superuser/CAP-miRSEQ/build/mirdeep2_patch-master:/home/superuser/CAP-miRSEQ/build/mirdeep2_patch-master:/home/superuser/CAP-miRSEQ/build/mirdeep2_patch-master:/home/superuser/CAP-miRSEQ/build/mirdeep2_patch-master:/home/superuser/mirdeep2_patch:/home/superuser/anaconda2/bin:/home/superuser/anaconda2/condabin:/home/superuser/bin:/home/superuser/CAP-miRSEQ/gatk-4.1.4.1/gatk:usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/superuser/QWRAP:/home/superuser/mirdeep2/bin:/home/superuser/CAP-miRSEQ/build/mirdeep2/bin:/home/superuser/CAP-miRSEQ/build/mirdeep2-0.1.3/bin:/home/superuser/CAP-miRSEQ/build/mirdeep2/bin

$ which -a R
/home/superuser/anaconda2/bin/R
ADD REPLY
0
Entering edit mode

Are you sure it installed correctly? According to that you only have 1 R, and it wasn't installed from apt...

I would try conda uninstall r-base, then sudo apt-get install r-base and make sure there were no errors or warnings.

Alternatively, just upgrade r-base in conda.

ADD REPLY
0
Entering edit mode

I did as you say and now It seems that I cant call R, as I obtain;

$ R
The program 'R' is currently not installed. You can install it by typing:
sudo apt install r-base-core
$ sudo apt install r-base-core
[sudo] password for superuser:
Reading package lists... Done
Building dependency tree
Reading state information... Done
r-base-core is already the newest version (3.6.2-1xenial).
0 upgraded, 0 newly installed, 0 to remove and 288 not upgraded.
(base)
ADD REPLY
0
Entering edit mode

The point of using conda environments is to make software installation independent of the system. Installing R from the system package manager is not going to have any effect on the R version installed in your conda environment. So if you use conda then install software with conda. If you want to use system software then exit your conda environment. Note that upgrading R usually means re-installing all the previously installed packages.

ADD REPLY
0
Entering edit mode

Hi jomagrax,

Please note that this is not exactly a bioinformatics question. While we can probably help you with this (and will try to if it turns out to be not that complicated), it's not in the scope of biostars to help with typical installation or unix issues. Stackoverflow would probably be a more suitable location, so please keep this in mind for further similar question.

Cheers,
Wouter

ADD REPLY
0
Entering edit mode

What version of Ubuntu are you using? This may be a repository issue if you are using Ubuntu 16.04 or older.

ADD REPLY
0
Entering edit mode

It seems that I have ububtu 16.04

Description:    Ubuntu 16.04.6 LTS
Release:        16.04
ADD REPLY
0
Entering edit mode

Make sure you have the correct repository for updating R. I also have Ubuntu 16.04 and changed my repository. Check your sources file found here /ect/apt/sources.list. I have deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/on my list and commented out deb https://lib.stat.cmu.edu/R/CRAN/bin/linux/ubuntu xenial/. Instructions for installation can be found here.

ADD REPLY
0
Entering edit mode

I have followed the instructions, It seems Its correctly installed in /usr/lib/R/bin/R but It does not open when I just type R

ADD REPLY
0
Entering edit mode

What does your source.list look like?

ADD REPLY
0
Entering edit mode
# deb http://es.archive.ubuntu.com/ubuntu/ xenial main restricted
deb https://cloud.r-project.org/bin/linux/ubuntu trusty-cran35/
# deb http://es.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb http://security.ubuntu.com/ubuntu xenial-security main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://es.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://es.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://es.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://es.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://es.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://es.archive.ubuntu.com/ubuntu/ xenial universe
deb http://es.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://es.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://es.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://es.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://es.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://es.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
ADD REPLY
0
Entering edit mode

I'm not quite sure what the error would be. If you followed all the instructions, it should have worked.

ADD REPLY
0
Entering edit mode

If R is installed but can't be found then it's a $PATH problem. It may be because you're still in an isolated conda environment. Get rid of anaconda or at list remove references to it from your .bash_profile.

ADD REPLY
0
Entering edit mode
4.2 years ago
jomagrax ▴ 40

I copied the binary from /usr/lib/R/bin/R to /usr/bin/ with

cp /usr/lib/R/bin/R /usr/bin/

And It seems to work

ADD COMMENT

Login before adding your answer.

Traffic: 1895 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6