I'm trying to get R's reticulate package to detect the Python interpreter in one of my conda-environments. Following several posts and questions, I've attempted to
set the
RETICULATE_PYTHON
environment variable in .Rprofile (both in user as well as project directory)set
RETICULATE_PYTHON
in a.Renviron
fileuse the provided helper functions
use_python()
anduse_condaenv()
,
all in vain. On start-up, the environment variable is correctly configured:
Sys.getenv("RETICULATE_PYTHON")
[1] "C:\\Users\\Othman\\anaconda3\\envs\\data_science\\python.exe"
but as soon as I run py_config()
, it automatically sets it to the global (base) Python install:
r$> py_config()
python: C:/Users/Othman/anaconda3/python.exe
libpython: C:/Users/Othman/anaconda3/python39.dll
pythonhome: C:/Users/Othman/anaconda3
version: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: C:/Users/Othman/anaconda3/Lib/site-packages/numpy
numpy_version: 1.20.3
NOTE: Python version was forced by RETICULATE_PYTHON
r$> Sys.getenv("RETICULATE_PYTHON")
[1] "C:\\Users\\Othman\\anaconda3\\python.exe"
Any idea what could be causing this?