How to add conda to path in RStudio with new conda initialization

reticulate
anaconda

#1

As of conda V.4.40 the correct way to put conda in the environment is no longer to add ...../conda/bin to your path. You are now supposed to source <path to conda>/conda/etc/profile.d/conda.sh. This is a major change that was not well publicized.

In the past, I updated my path in RStudio to start with my conda path. What is the way to do it now?

I the past I put this in my .Rprofile:

Sys.setenv(PATH=paste0('/home/conda/bin:', Sys.getenv('PATH')))
library('reticulate')

I now added:

system('. /home/balter/conda/etc/profile.d/conda.sh')

But when I try to use reticulate in RStudio, this happens:

> use_condaenv('microbiome') 
Error: Unable to find conda binary. Is Anaconda installed?

Note: In command-line R, it works fine. The only problem is in RStudio.