-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reticulate doesn't detect libpython.so from binary #836
Comments
Does this work with the development version of reticulate? |
@kevinushey |
I have the identical problem on Mac OS X 10.15.6. The trouble here is that on a stock system we can't even set DYLD_LIBRARY_PATH, so reticulate doesn't work at all.
|
Currently library(reticulate)
reticulate::use_python("~/.pyenv/versions/3.9.4/bin/python3", required = TRUE)
script = "
from distutils.sysconfig import get_config_var
libdir = get_config_var('LIBDIR')
instsoname = get_config_var('INSTSONAME')
print(f'{libdir}/{instsoname}')
"
python = path.expand(reticulate:::.globals$use_python_versions[[1]])
system2(python, args = "-", input = script)
# /Users/watal/.pyenv/versions/3.9.4/lib/libpython3.9.a (of course this will not be the best implementation, though.) |
@heavywatal That seems like a good idea. We could probably add it to our Python config script: https://github.com/rstudio/reticulate/blob/master/inst/config/config.py If that succeeds in finding the shared library explicitly, then we could use that. (Note: would need to verify this works for regular Python installs, virtual environments, and Conda environments) |
I have python3.7.9 installed in a local folder: $HOME/opt/python37, but reticulate is not able to infer the location of libpython from the path to the python binary
In order to fix this I have to set LD_LIBRARY_PATH explicitly either in .profle or in R session using Sys.setenv() like so
According to the documentation reticulate is able to infer the location of libpython from the binary with use_python() or setting RETICULATE_PYTHON (using use_python("/home/bee/opt/python37/bin/python") instead of Sys.setenv(RETICULATE_PYTHON=..) above without setting LD_LIBRARY_PATH gave the same uninformative error,--I figured out it is about missing libpython by running /usr/lib/R/site-library/reticulate/config/config.py with this version of python.)
OS is ubuntu 20.04,
R 4.0.2,
reticulate-1.16
Same behaviour in rstudio 1.3.1073 and running R in the terminal
I have the same setup in Ubuntu 16.04 and python3.8.5 and python3.7.8 installed locally but reticulate is able to detect libpython from the python binaries (can't check the detailed configuration and versions there since I have no access to that machine at the moment)
The text was updated successfully, but these errors were encountered: