[R] reticulate + virtual environments
Sigbert Klinke
@|gbert @end|ng |rom w|w|@hu-ber||n@de
Mon Jul 15 07:56:17 CEST 2024
Hi,
I am using reticulate and a virtual environment (not conda) to run
Python scripts from RStudio. However, when I try to use my own
(existing) virtual environment, reticulate does not use it. If I run my
scripts, the installed modules (e.g., py_install("pandas",
"mmstat4.hu.data")) are not found. I believe this happens because
reticulate is using r-reticulate instead of mmstat4.hu.data. How can I
force reticulate to use my virtual environment?
Thanks Sigbert
> library("reticulate")
> py_config()
python: /home/sk/.virtualenvs/r-reticulate/bin/python
libpython:
/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so
pythonhome:
/home/sk/.virtualenvs/r-reticulate:/home/sk/.virtualenvs/r-reticulate
version: 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0]
numpy:
/home/sk/.virtualenvs/r-reticulate/lib/python3.10/site-packages/numpy
numpy_version: 2.0.0
> use_virtualenv("mmstat4.hu.data", required = TRUE)
> py_config()
python: /home/sk/.virtualenvs/r-reticulate/bin/python
libpython:
/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so
pythonhome:
/home/sk/.virtualenvs/r-reticulate:/home/sk/.virtualenvs/r-reticulate
version: 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0]
numpy:
/home/sk/.virtualenvs/r-reticulate/lib/python3.10/site-packages/numpy
numpy_version: 2.0.0
--
https://hu.berlin/sk
https://hu.berlin/mmstat
More information about the R-help
mailing list