How-To: RStudio: Launch RStudio in Conda Environment From Command Line

Question

How do I launch RStudio in a Conda environment from the command line?

 

Answer

1. Open an Anaconda prompt or terminal.

Note:  To open an Anaconda prompt in Windows or the Terminal in MacOS, see "How-To: Using Anaconda -  Launch a Virtual Conda Environment via Command Line Interface

 

2. From the command line (CLI) in the base environment, activate the conda environment you wish to use.

anaconda prompt with quotation mark conda activate my_rstudio_env quotation mark

 

3. From the CLI in the activated environment, add the Rstudio executable to the path:

set path="C:\Program Files\RStudio";%path%

anaconda prompt with quotation mark set path equals symbol quotation mark C colorn backslash Program Files backslash RStudio quotation mark semicolon percent symbol path quotation mark

Note:  Enure RStudio was installed from the company portal so the above path is correct, see "How-To: Install RStudio From Company Portal"

 

4. From the CLI in the activated environment, enter "rstudio" to launch.

anaconda prompt with quotation mark semicolon rstudio quotation mark semicolon