I am really struggling to get reticulate to work for me.
I ran reticulate::repl_python()
and got the normal flag asking me if I wanted to set up a virtual environment. I said yes but now when I run reticulate::repl_python()
I get an error:
Error: PyType_GetFlags - /usr/lib64/libpython2.7.so.1.0: undefined symbol: PyType_GetFlags
In addition: Warning message:
In py_initialize(config$python, config$libpython, config$pythonhome, :
Python 2 reached EOL on January 1, 2020. Python 2 compatability will be removed in an upcoming reticulate relesae.
I found this Posit Communit post on a similar error and followed their advice to reinstall reticulate
using devtools
but I am still getting the same error.
Reading the git issue chain that was linked to the Posit issue it sounded like I could use use_python
to set which python instance to use and that might solve the problem. So then I ran
reticulate::use_python("/bin/python3")
reticulate::repl_python()
And I get out a giant error which then cause my R session to be aborted. Error reads:
[522345:522345:20240502,10581.255126:ERROR process memory_range.cc:86] read of of range
[522345:522345:20240502,10581.255126:ERROR elf_image_reader.cc:558] missing nul-terminator
[522345:522345:20240502,10581.255126:ERROR elf_dynamic_array_reader.h:61] tag not found
.
.
.
[522345:522345:20240502,10581.255126:ERROR elf_dynamic_array_reader.h:61] tag not found
[522345:522345:20240502,10581.255126:ERROR directory_reader_posix.cc:42] opendir: No such file or directory (2)
I am running R 4.2.1, R Studio 2023.12 on a Red Hat 8.4 server.
Updates 1:
- I tried reinstalling
reticulate
that did not help - When I run
py_run_string("import sys; print(sys.version)")
as a test I get the firstPyType_GetFlags
error as written above.
Updates 2:
- After ignoring this problem for several weeks I have no uninstalled and reinstalled
reticulate
and now I am getting new behavior - When I run
reticulate::py_run_string("import sys; print(sys.version)")
I get:
3.6.8 (default, Jun 14 2022, 12:54:58)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)]
and when I run reticulate::py_config()
I get:
python: /usr/bin/python3
libpython: /usr/lib64/libpython3.6m.so
pythonhome: //usr://usr
version: 3.6.8 (default, Jun 14 2022, 12:54:58) [GCC 8.5.0 20210514 (Red Hat 8.5.0-10)]
numpy: [NOT FOUND]
NOTE: Python version was forced by RETICULATE_PYTHON_FALLBACK
so it seems now my instance is recognize and using Python 3.
3. However when I run reticulate::repl_python()
I am still getting crazy fatal errors that cause R Studio to abort, see below.