Issues using virtual environment when running python from R Studio

Hi everyone,

I am trying to knit a PDF file from R Studio but I need to use Python in the script. I also need to run a virtual environment with Python, which I have setup using Anaconda. I am directing to this virtual environment with:

pathToPython <- "path where python is installed"
Sys.setenv(RETICULATE_PYTHON = pathToPython)

And this works fine when I am not using a path that is from a virtual environment. However, as soon as I use a path for a virtual environment I get the following error, which I have been stuck on since a long time now:

I understand that the error is related to something with the path of the virtual environment, but I cannot pinpoint exactly to why this error shows up if this is exactly the path that is printed when doing something like "WHERE PYTHON" from the command line

Any help is appreciated

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.