Opening R Studio with Conda-env version of R fails unless launched via conda prompt

This is a minor foible with Rstudio that I've discovered a work-around for. But I think a more user-friendly behaviour should be easy enough. So I wanted to see if any others had encountered it, or any thoughts, before potentially raising an issue.

I'm working on a project at work that spans both R and Python code. And I wanted to use RStudio proper (as opposed to the conda-distributed version) to edit all of my R code. However, I wanted to be able to use conda to manage the installation of base R, so that I could specify the version of R itself using a yml file with conda. (I think using renv for managing all non-base packages seems good).

RStudio can easily be pointed to a different installed version of R from Tools>Global Options. On choosing a new version (including a conda-installed version in a conda virtual-environment). It requires a restart, which seems fair enough. However, on restarting RStudio though most conventional methods (search bar, shortcut) if the R version was within a conda env, Rstudio fails to launch, and provides this rather unhelpful error:

Screen Shot 2020-07-08 at 10.58.57 am

To work around this: I launch the anaconda prompt, activate the virtual environment containing the version of R that I had earlier pointed Rstudio to, and run call rstudio.exe from within the anaconda prompt. Then Rstudio opens fine, and recognises the version of R from that I intended within the conda env.

A much more pleasant behaviour would be for Rstudio to open up, and present a clear error that it can't use the requested install of R. This would then hopefully allow a user recognise that they need to activate the conda env, or allow them to edit (within Global Options) the choice of R, perhaps back to a conventionally installed version that Rstudio can recognise. This is what Pycharm does when it opens without a configured Python interpreter, and seems a much more graceful method of failure.

Has anyone else encountered this, or have thoughts, or an easier solution?

I'm working on a Windows 10 VM on Azure. RStudio version 1.2.5042

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.