I have installed rpy2 via pip and I run into the following issue.
import rpy2.robjects as robjects
returns :
ModuleNotFoundError: No module named '_rinterface_cffi_abi'
I made sure before installing to have R properly installed, my RHOME (and R_HOME just for good measure) setup to /usr/lib/R. I am inside a Python virtual environment. And cffi is on version 1.16.0.
When I run
python3 -m rpy2.situation
I get the following :
rpy2 version:
3.5.15
Python version:
3.8.10 (default, Nov 22 2023, 10:22:35)
[GCC 9.4.0]
Looking for R's HOME:
Environment variable R_HOME: /usr/lib/R
Calling `R RHOME`: /usr/lib/R
Environment variable R_LIBS_USER: None
R's value for LD_LIBRARY_PATH:
/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server
R version:
In the PATH: R version 4.3.2 (2023-10-31) -- "Eye Holes"
Loading R library from rpy2: *** Error while loading: No module named '_rinterface_cffi_api' ***
Additional directories to load R packages from:
None
C extension compilation:
include:
['/usr/share/R/include']
libraries:
['R', 'pcre2-8', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm', 'icuuc', 'icui18n']
library_dirs:
['/usr/lib/R/lib']
extra_compile_args:
['-std=c99']
extra_link_args:
['-Wl,--export-dynamic', '-fopenmp', '-Wl,-Bsymbolic-functions', '-Wl,-z,relro']
Directory for the R shared library:
lib
CFFI extension type
Environment variable: RPY2_CFFI_MODE
Value: CFFI_MODE.API
ABI: ABSENT
API: ABSENT
I was expecting either ABI or API CFFI extension type to be present. I suspect that the absence of this _rinterface_cffi_api module makes the install switch to ABI ode, and that also fails.
So why is ABI failing ? ALso, am I missing the required module to access via API using the pip install ?