I'm using a Mac and have an Rstudio project ( my_project below) which I set up with renv and in my .Rprofile inside the project's directory I put these lines:
source("renv/activate.R")
renv::use_python()
Then in RStudio I did Session -> Restart R , which created R and Python virtual environments.
Then in RStudio 's terminal window I ran the command:
renv/python/virtualenvs/renv-python-3.7.3/bin/pip install pandas
I then installed the reticulate R package.
Now, within RStudio I'm trying to import the pandas python package using:
renv::use_python()
library(reticulate)
pd <- reticulate::import("pandas")
And after the third line I'm getting:
Error: Python shared library not found, Python bindings not loaded.
Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment.
I also tried sourcing the python virtualenv in RStudio 's terminal window:
dr-mba-1035:scRNAseqShiny dr$ source /Users/dr/my_project/renv/python/virtualenvs/renv-python-3.7.3/bin/activate
(renv-python-3.7.3) dr-mba-1035:my_project dr$
And then go and repeat the R code lines above but I'm getting the same error.
However, I am able to launch python from that command line window and successfully import pandas there.
Any idea?