-
Notifications
You must be signed in to change notification settings - Fork 339
py_available() always returns FALSE although Python is installed #385
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
Comments
We also experienced the same problem: The problem is that on Clearlinux LIBDIR is set to I temporarily fixed it with this by hardcoding the value:
try:
import sysconfig
if not platform.system() == 'Windows':
+ sysconfig._CONFIG_VARS['LIBDIR'] = '/usr/lib64'
sys.stdout.write('\nLIBPL: ' + sysconfig.get_config_vars('LIBPL')[0])
sys.stdout.write('\nLIBDIR: ' + sysconfig.get_config_vars('LIBDIR')[0])
sys.stdout.write('\nPREFIX: ' + sysconfig.get_config_vars('prefix')[0])
sys.stdout.write('\nEXEC_PREFIX: ' + sysconfig.get_config_vars('exec_prefix')[0])
except Exception:
pass The code in JuliaPy (on which this was based according to https://github.com/rstudio/reticulate/blob/24805aa1af2a6e59d22c5e088f2c358fff9e2b3b/inst/config/config.py) works correctly (finds the library in LD_LIBRARY_PATH):
|
Apologize but I can't catch you. Do you mean that you're using Clear Linux OS and you fixed the problem manually by adding the Can you show me where the config.py is? I don't use JuliaPy and I'm new to Python as well. |
The following should give the base dir of the reticulate package: library('reticulate')
path.package('reticulate') Then find libpython3.7: find / -name 'libpython3.7*' |
Sorry that I am new to everything. |
I'm trying to trace this down. Here's what I find...
> py_discover_config()
python: C:\Users\markn\AppData\Local\Programs\Python\Python38\python.exe
libpython: C:/Users/markn/AppData/Local/Programs/Python/Python38/python38.dll
pythonhome: C:\Users\markn\AppData\Local\Programs\Python\Python38
version: 3.8.0a1 (tags/v3.8.0a1:e75eeb00b5, Feb 3 2019, 20:47:39) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: [NOT FOUND]
python versions found:
C:\Users\markn\AppData\Local\Programs\Python\Python38\python.exe
C:\Users\markn\AppData\Local\Programs\Python\PYTHON~1\\python.exe
C:\Users\markn\AppData\Local\Programs\Python\Python38\\python.exe
removes the error related to Py_CompileString, but
Question: Should the parameters to initialize_python be defined as something? Why are they just listed in the function call without some sort of "=" ?
Here is a dump of the variables being passed to py_initialize...
... and we exit py_available with return FALSE |
I'm not sure what the difference is, but I was experiencing this issue using Python 3.8 on Windows 10. I was able to solve it by installing Anaconda for Windows and changing my Sys.setenv(RETICULATE_PYTHON = PATH) to use Anaconda python instead of the regular python binary. Not sure what the underlying issue is, but it would appear that reticulate just doesn't like standard python on Windows. |
I have the same issue using Python 3.8 on Windows 10. Everything is newly installed, so it is not caused by outdated software. I will try @ncoppersmith-r7 's suggestion. Please fix it... |
It would help if you shared the error you were seeing. |
Here's what I see with the CRAN version of
And with the development version of
Assuming that you're seeing the same issue, this is fixed in the development version of |
try use python 3.6 instead, it works for me |
Have this issue as well. R 4.0, Python 3.7, miniconda3 recently installed, OS X Catalina
I'm running the following code:
Finally fixed this by running Anyway I figured it out -- maybe this is something documentation could focus on? I notice the video on the Rstudio website focuses on virtualenv but a lot of the actual reticulate functions focus on conda... thanks for all your help! |
@setgree That worked for me, really appreciate it! |
Hi
I'm using Mac OS 10.13.6 and I installed Python 3.7.1 by using pyenv. I already switched to that version by
pyenv global 3.7.1
. So it returns 3.7.1 when I check by$ python --version
and returns two Python directories namely '/Users/tampm/.pyenv/shims/python' and '/usr/bin/python' when I run$ which -a python
.But unfortunately, when I call py_available() method on R console, it always returns FALSE although I can see two Python directories mentioned above when I call py_discover_config() method.
Would anyone mind helping me to solve that issue?
Update if I try to call import a Python library on R console and call py_available() method again, it returns TRUE. I did
It is quite wierd, isn't it? Did I do something wrong in my Python installation?
Thanks
The text was updated successfully, but these errors were encountered: