O.rka O.rka - 2 months ago 63x
R Question

How to set up conda-installed R for use with RStudio?

enter image description here

I've been trying to set up my

(eventually to use with Beaker Notebook) and I want to be able to use
with my conda-installed version of

My method of installing

conda install -c r r
conda install -c r r-essentials
conda install -c r r-rserve
conda install -c r r-devtools
conda install -c r r-rcurl
conda install -c r r-RJSONIO
conda install -c r r-jpeg
conda install -c r r-png
conda install -c r r-roxygen2
conda install --channel https://conda.anaconda.org/bioconda bioconductor-edger

I ran that version of R (I only installed this version)

> version
platform x86_64-apple-darwin11.0.0
arch x86_64
os darwin11.0.0
system x86_64, darwin11.0.0
major 3
minor 3.1
year 2016
month 06
day 21
svn rev 70800
language R
version.string R version 3.3.1 (2016-06-21)
nickname Bug in Your Hair

is kind of buggy. For example, when it outputs errors, it outputs to
and splits every character in the string with a linebreak. I want to use
but I don't want to install another version of

How can I route my conda version of
into RStudio?

Here's my
not sure if this will be useful:

$ cat ~/.bash_profile
# added by Anaconda3 4.0.0 installer
export PATH="/Users/jespinoz/anaconda/bin:$PATH"

export RSTUDIO_WHICH_R=/Users/jespinoz/anaconda/bin/R

I've been trying to follow these tutorials but I am lost. I'm really not too familiar with environment variables and such things.

(1) https://support.rstudio.com/hc/en-us/community/posts/207830688-Using-RStudio-with-conda

(2) Launch mac eclipse with environment variables set

when I looked for my
it directed me to:

$ which R

but the directions from (1) is using this path which is very confusing:


I tried doing what this guy did and added this to my
but it didn't work. I even made a
but it still didn't work (I
both after I added the lines)

export RSTUDIO_WHICH_R=/Users/jespinoz/anaconda/bin/R

How to tell RStudio to use R version from Anaconda

has no tutorial for this in https://docs.continuum.io/anaconda/ide_integration


So long as which R shows up a working R interpreter (which it should do if you have installed the r package from conda and activated your environment) then launching rstudio from that same environment should pick it up just fine.

For a test, on ArchLinux, I built and installed: https://aur.archlinux.org/packages/rstudio-desktop-git/

.. then force removed the R interpreter (pacman -Rdd r), then installed r from conda (conda install -c r r) and it worked fine. I then closed my terminal and opened a new one (so that the correct conda environment was not activated and successfully launched RStudio with the following command: RSTUDIO_WHICH_R=/home/ray/r_3_3_1-x64-3.5/bin/R rstudio

I think the crux is to launch RStudio from the right environment? Your ~/.bash_profile and ~/.bashrc are only sourced when you run bash. For environment variables to be set so that the your desktop environment knows about them, on Linux, you should put them in ~/.profile or else in /etc/pam.d (you may need to logout or shutdown after making those changes) and on OS X, you should check out http://apple.stackexchange.com/q/57385