How to use R installed by conda instead of it installed by apt on Ubuntu
0
0
Entering edit mode
18 months ago
Zhichao • 0

I'm doing some bioinformatics analysis on a server running Ubuntu, and I use R in some workflow. The server administrator installed R for all users using apt. However, recently I encountered an issue where a R package couldn't be installed due to the high version of R. As a solution, I created a new environment using conda and installed a lower version of R. However, when I enter the R environment in the terminal, it still uses the high version of R installed via apt. How can I use the lower version of R installed through conda instead of the higher version installed via apt?

R ubuntu conda • 2.3k views
ADD COMMENT
0
Entering edit mode

Did you activate your conda environment? Is conda in PATH? Please describe what you did.

Edit: Generally, what I exclusively do these days is to run code and analysis via containers, such as Docker and Singularity, given that your server allows this. It's really convenient as you can freely build containers in a fixed environment (for example an Ubuntu container) so there is no issues with dependency installation etc, and it is even portable by pushing to Docker Hub. I personally was sick to always fight with compilation on my local machine, on the HPC, maybe another machine if the old one got replaced, Mac, Linux, Windows blabla. With Docker I run the same container everywhere. Amen :)

ADD REPLY
0
Entering edit mode

yes, I have activated this conda environment. And the conda is in PATH .

At first, I create a new conda environment conda create -n newR.

And then, activate this conda environment conda activate newR.

I install the low version R in this conda environment conda install -c conda-forge r-base=4.1.1.

Then, I input R in the terminal to enter the R in this conda environment.

ADD REPLY
1
Entering edit mode

Please follow this sequence of steps and show us the outputs:

# Start from a fresh terminal with no conda environment active:
which -a R
R --version | head -n 1
# Next, load the conda environment
conda activate newR
which -a R
R --version | head -n 1
ADD REPLY
0
Entering edit mode

if you are doing these steps then the R version should be 4.1.1. Are you sure there weren't any errors during the install of r-base=4.1.1?

ADD REPLY

Login before adding your answer.

Traffic: 1682 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