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

Cannot find libffi.so #16

Open
wouterbeek opened this issue Feb 10, 2023 · 6 comments
Open

Cannot find libffi.so #16

wouterbeek opened this issue Feb 10, 2023 · 6 comments

Comments

@wouterbeek
Copy link

Observed

When I run classify_nodes.py I get an error about libffi.so not being found:

(torch_rgcn_venv) ~/tmp/torch-rgcn$ python experiments/classify_nodes.py with configs/rgcn/nc-AIFB.yaml 
Traceback (most recent call last):
  File "experiments/classify_nodes.py", line 1, in <module>
    from utils.misc import create_experiment
  File "/home/wouter/tmp/torch-rgcn/utils/misc.py", line 1, in <module>
    from sacred import Experiment
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/__init__.py", line 11, in <module>
    from sacred.experiment import Experiment
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/experiment.py", line 26, in <module>
    from sacred.initialize import create_run
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/initialize.py", line 17, in <module>
    from sacred.host_info import get_host_info
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/host_info.py", line 11, in <module>
    import cpuinfo
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/cpuinfo/__init__.py", line 3, in <module>
    from cpuinfo.cpuinfo import *
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/cpuinfo/cpuinfo.py", line 34, in <module>
    import ctypes
  File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: libffi.so.6: cannot open shared object file: No such file or directory

Expected

The shared library to be found by classify_nodes.py.

@thiviyanT
Copy link
Owner

Hey!

Thanks for reporting this. I have not experienced this issue before.

By any chance, are you using a Linux machine?

@wouterbeek
Copy link
Author

@thiviyanT Yes, I'm on Ubuntu 22.04 LTS

@thiviyanT
Copy link
Owner

Thanks! It seems that this is a common problem for Linux users. Next week, I will dive a bit deeper into why this is happening.

In the meantime, this solution seems to be promising: https://stackoverflow.com/a/63329830. You will need to install the library yourself. Please note that there is an extra step for Ubuntu 22.04.

From the traceback, I can see that this error comes from the sacred python package. It is not a critical package for running the model; we used sacred for monitoring our ML experiments. Maybe I will remove it from the repository.

@wouterbeek
Copy link
Author

Thanks for looking into this @thiviyanT !

Is it possible to install the 2019 version of libffi inside the environment for torch-rgcn? (A system-wide installation of a core library from a different distribution version may break other programs.)

@thiviyanT
Copy link
Owner

@wouterbeek I agree that a system-wide installation may be catastrophic. I would also recommend doing it inside your virtual environment. After all, if you look at your trackback it says that the libffi.so.6 file is missing from your torch_rgcn_venv environment. So, a system-wide installation would be futile.

I have read more about this issue. Some have said that uninstalling and reinstalling Python has fixed this problem. Note that you need to do this inside your Python env.

Another suggestion: This post says that Ubuntu 20.04 (and above) have upgraded libffi6 to libffi7, and Python is still looking libffi6. If you can locate libffi.so.7, you can create a simlink: sudo ln -s /usr/path/to/libffi.so.7 /usr/lib/path/to/libffi.so.6

@thiviyanT
Copy link
Owner

Any luck @wouterbeek?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants