Skip to content
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

bug while importing rpy2: cannot open shared object file: No such file or directory #1042

Open
wanlinjuan opened this issue Jun 21, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@wanlinjuan
Copy link

wanlinjuan commented Jun 21, 2023

I have successfully installed rpy2, but have trouble while importing rpy2. Here are my codes:

import os, sys
import rpy2
from rpy2.robjects import r
# %load_ext rpy2.ipython

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/.local/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py in <module>
     13     try:
---> 14         import _rinterface_cffi_api as _rinterface_cffi
     15     except ImportError:

ModuleNotFoundError: No module named '_rinterface_cffi_api'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
/tmp/ipykernel_88811/4253977157.py in <module>
     15 
     16 import rpy2
---> 17 from rpy2.robjects import r
     18 # %load_ext rpy2.ipython
     19 

~/.local/lib/python3.7/site-packages/rpy2/robjects/__init__.py in <module>
     14 from functools import partial
     15 import types
---> 16 import rpy2.rinterface as rinterface
     17 import rpy2.rlike.container as rlc
     18 

~/.local/lib/python3.7/site-packages/rpy2/rinterface.py in <module>
     10 import warnings
     11 from typing import Union
---> 12 from rpy2.rinterface_lib import openrlib
     13 import rpy2.rinterface_lib._rinterface_capi as _rinterface
     14 import rpy2.rinterface_lib.embedded as embedded

~/.local/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py in <module>
     14         import _rinterface_cffi_api as _rinterface_cffi
     15     except ImportError:
---> 16         import _rinterface_cffi_abi as _rinterface_cffi
     17 
     18 ffi = _rinterface_cffi.ffi

~/.local/lib/python3.7/site-packages/_rinterface_cffi_abi.py in <module>
      1 # auto-generated file
----> 2 import _cffi_backend
      3 
      4 ffi = _cffi_backend.FFI('_rinterface_cffi_abi',
      5     _version = 0x2601,

ImportError: libffi.so.7: cannot open shared object file: No such file or directory

I already tried conda install cffi, and it seems like a sucesss. But still the same error.

Thank you so much!

@wanlinjuan wanlinjuan added the bug Something isn't working label Jun 21, 2023
@lgautier
Copy link
Member

lgautier commented Jul 3, 2023

This seems odd. Did you install rpy2 and cffi the same way?

@wanlinjuan
Copy link
Author

This seems odd. Did you install rpy2 and cffi the same way?

Yes! I confirm I have successfully installed rpy2 and cffi.

@lgautier
Copy link
Member

lgautier commented Jul 6, 2023

Did you install them the same way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants