You have to discover the path to your the .exe python file and then specify it in the .Renviron file.
The best is to create a conda environment to your project and then specify it as your reticulate path.
library(reticulate)
conda_create("environment name", packages = c("pandas", "matplotlib", "seaborn"), conda = "auto") # creates conda environment for your project
conda_python("environment name") # returns the .exe python path for your environment
Keep this path for the .Renviron file!!
To edit the .Renviron file:
library(usethis)
edit_r_environ()
Then, the .Renviron file will open. Paste the .exe path in it as follows:
RETICULATE_PYTHON="YOUR ENVIRONMENT PATH/python.exe"
Remember to paste it with / instead of "\".
Restart the R session and use the following command to check if everything is right:
library(reticulate)
py_config()
If everything is right, you should get something like:
python: YOUR ENVIRONMENT PATH/python.exe
libpython: YOUR ENVIRONMENT PATH/python39.dll
pythonhome: YOUR ENVIRONMENT PATH
version: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: YOUR ENVIRONMENT PATH\lib\site-packages\numpy
numpy_version: 1.21.2
After this it should work :)