2

Cannot use virtual environment (python) in rstudio (provided by package reticulate)

I run the code:

library(reticulate)

#Environment already created
use_condaenv("env_ret")
py_config()

And get the output:

python:         C:\PROGRA~1\ANACON~1\python.exe
libpython:      C:/PROGRA~1/ANACON~1/python37.dll
pythonhome:     C:\PROGRA~1\ANACON~1
version:        3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:\PROGRA~1\ANACON~1\lib\site-packages\numpy
numpy_version:  1.15.4

python versions found: 
 C:\Program Files\Anaconda3\envs\env_ret\python.exe
 C:\PROGRA~1\ANACON~1\python.exe
 C:\Program Files\Anaconda3\python.exe
 C:\Program Files\Anaconda3\envs\my-env\python.exe

This means that even though i set the path to the virtual environment (create in conda), the machine continues to assume the "C:\PROGRA~1\ANACON~1\python.exe" path (the one by default).

RSTUDIO version: 1.2.1335 R version: 3.6.1 Python: 3.7.1

Thanks for your attention

Catarina
  • 53
  • 5
  • From the docs: "The `use_condaenv` function will use whatever conda binary is found on the system PATH. If you want to use a specific alternate version you can use the conda parameter. For example: `use_condaenv(condaenv = "r-nlp", conda = "/opt/anaconda3/bin/conda")` " Can you try like this? – novica Dec 10 '19 at 16:34
  • @novica I got the following error: > use_condaenv(condaenv="env_ret", conda= "C:\\Program Files\\Anaconda3\\Scripts\\conda") Error in system2(conda, args = c("info", "--json"), stdout = TRUE, stderr = FALSE) : '"C:\Program Files\Anaconda3\Scripts\conda"' not found – Catarina Dec 10 '19 at 16:52
  • 1
    @novica i mean, the machine knows that the environment exists and knows the path as you can see in my post "python versions found". – Catarina Dec 10 '19 at 16:54
  • I'm having the exact same issue and the docs aren't particularly helpful. Running windows 10 as I'm trying to set this up on a work computer. – KevOMalley743 Oct 14 '20 at 14:22

0 Answers0