Should/can you run R Studio in Conda?

I think there are at least 3 different possible combinations:

  1. Install RStudio into a conda environment as a conda binary
  2. Install RStudio normally, but then install R and the packages you need in a conda environment. Then activate your conda environment and launch RStudio so that it uses your conda-installed R
  3. Manage external conda environments via {reticulate}

Here are my thoughts on each one of these scenarios:

  1. This is the most difficult to achieve. As I recently noted here, it's very difficult to package RStudio into a conda binary. Until someone figures out a good way to do this, this will be an unpleasant experience (outdated RStudio and likely some features won't work as expected)
  2. This is manageable if you are using Linux, macOS, or Docker/Singularity. Install R and the packages you need into a conda env, activate it, and then launch RStudio. You might have to set a few env vars to get everything working right. A user posted last month on how they were able to launch RStudio inside a conda environment on Ubuntu. I also recommend checking out grst/rstudio-server-conda for running RStudio Server from inside a conda env installed in a Docker/Singularity container
  3. As Randy explained above, it's possible to manage external conda envs via {reticulate}. This is fine as a way to get Python packages installed, but it's not a good solution if you want holistic management of all your project's dependencies. And just my personal experience as a long-time conda user, but I have found that trying to manage conda envs via calls to {reticulate} functions to be very frustrating. I find it much easier to run conda commands directly in the terminal

All that being said, I would sum up the situation as:

  • Yes, you can launch RStudio to use R that was installed inside a conda environment
  • But Posit does not officially support this use case, so it might require some tinkering to get it working on your machine