I have been trying to run some python code via R reticulate with no success. I tried creating a virtual environment and install two packages in it: numpy and a GitHub package called scrublet.
library(reticulate)
if(!"r-scrublet" %in% virtualenv_list()) {
virtualenv_create("r-scrublet")
virtualenv_install("r-scrublet", c("numpy","git+https://github.com/AllonKleinLab/scrublet.git"))
}
use_virtualenv(virtualenv = "r-scrublet", required = T)
Then I want to activate the environment and run code over it. When I run py_discover_config()
I get output:
python: C:/Users/gilad/Documents/.virtualenvs/r-scrublet/Scripts/python.exe
libpython: C:/Users/gilad/Documents/.virtualenvs/r-scrublet/Scripts/python36.dll
pythonhome: C:/Users/gilad/Documents/.virtualenvs/r-scrublet
version: 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
Architecture: 64bit
numpy: C:/Users/gilad/Documents/.virtualenvs/r-scrublet/Lib/site-packages/numpy
numpy_version: 1.19.1
NOTE: Python version was forced by use_python function
which seems to be as I want. The problem is that I don't seem to be able to actually use this environment. If I test weather numpy is available (py_numpy_available()
) I get that not and when I try any import
statement (either to one of the installed packages or even to something like os
) R crashes with:
R Session Aborted. R encountered a fatal error. The session was terminated
I tried the different reticulate manuals (here and here) and different git issues or SO questions but couldn't still figure this out.