Configuring Python for Rstudio in Windows 10 (reticulate)


I'm relatively new to R and Rstudio but I am seeking to learn to integrate R and python into projects and would like to use Rstudio as my IDE. I have followed this link to get everything set up.

This page suggests that I should be creating python virtualenvs for each project, however, when I run reticulate::py_config() it appears that Rstudio is only finding my anaconda distribution.

What I have done is:

1 Fresh install of R, Rstudio and Python

#in windows powershell run as admin

2 Create directory called test_r on my desktop. (mkdir test_r)

3 cd into that directory (cd C:\Users\\Desktop\test_r)

4 create a virtual environment (virtualenv .venv)

5 activate the environment (.venv\Scripts\activate)

#leave power shell open with .venv active

6 open Rstudio

7 Install reticulate
8 set wd to my test_r directory (setwd('path\\to\\test_r')

9 create a .Rprofile with the text

Sys.setenv(RETICULATE_PYTHON = ".venv\\Scripts\\python")

10 restart the R session

11 run reticulate::py_config()

This still shows that reticulate is calling the anaconda distribution rather than my straight python installation.

python:         C:/Users/
libpython:      C:/Users/
pythonhome:     C:/Users/
version:        3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/
numpy_version:  1.16.5

python versions found: 

Any help or guidance would be much appreciated as I have been convinced that integrating python and R is the best way to solve a particular problem facing my org but if I can't get this running then I'll have to hunt around again for a solution.

Thanks in advance,


1 Like

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