You can now use RStudio as an effective Python IDE. To do so, follow these steps after installing miniconda:
Install the {reticulate} package: install.packages("reticulate")
Install the {png} package (a dependency of reticulate that is not well managed yet): install.packages("png")
Find your path to miniconda by typing which python
in a terminal (Git Bash on Windows) outside of RStudio
Specify that {reticulate} should use the miniconda version of Python in your .Rprofile
file:
usethis::edit_r_profile()
into the R console inside RStudio, and an .Rprofile
file from your HOME directory should open in RStudio.Rprofile
file: Sys.setenv(RETICULATE_PYTHON = "path_to_miniconda's_python")
replacing "path_to_miniconda's_python"
with the path to your miniconda PythonIn terminal type code ~/.bash_profile
and add the line export PATH="/opt/miniconda3/bin:$PATH"
, replacing /opt/miniconda3/bin
with the path to the folder containing your miniconda Python (be careful not to include python
at the end of this path).
Restart R!
Start using Python in RStudio by typing reticulate::repl_python()
in the R console, or running a line of Python code from a Python script from the RStudio editor by Cntrl + enter. Or by running scripts from the terminal inside RStudio.
Install the {reticulate} package: install.packages("reticulate")
Install the {png} package (a dependency of reticulate that is not well managed yet): install.packages("png")
Find your path to miniconda by typing which python
in a terminal (Git Bash on Windows) outside of RStudio
Specify that {reticulate} should use the miniconda version of Python in your .Rprofile
file:
usethis::edit_r_profile()
into the R console inside RStudio, and an .Rprofile
file from your HOME directory should open in RStudio.Rprofile
file: Sys.setenv(RETICULATE_PYTHON = "path_to_miniconda's_python")
replacing "path_to_miniconda's_python"
with the path to your miniconda Python. In Windows, you need \\
instead of a \
to separate the directories, for example my path here would be: C:\\Users\\tiffany.timbers\\miniconda3\\python.exe
.C:/Program Files/Git/bin/bash.exe
) as the “Custom shell binary” option. Finally set -l
(lower case L) as the option for “Custom shell command-line options”.reticulate::repl_python()
in the R console, or running a line of Python code from a Python script from the RStudio editor by Cntrl + enter. Or by running scripts from the terminal inside RStudio.