Skip to content

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

  • by

Too advanced

tl;dr: if you have issues and can’t update, you can install the libffi7 package as a temporary workaround

After a recent Arch update, python packages / applications using ctypes, such as yt-dlp, were throwing an error:

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

or more fully:

Traceback (most recent call last):                                                                                  
  File "/home/robert/.pyenv/versions/3.9.5/lib/python3.9/runpy.py", line 197, in _run_module_as_main                
    return _run_code(code, main_globals, None,                                                                      
  File "/home/robert/.pyenv/versions/3.9.5/lib/python3.9/runpy.py", line 87, in _run_code                           
    exec(code, run_globals)                                                                                         
  File "/home/robert/ytdlp/__main__.py", line 16, in <module>                                                       
  File "<frozen zipimport>", line 259, in load_module                                                               
  File "/home/robert/ytdlp/yt_dlp/__init__.py", line 16, in <module>                                                
  File "<frozen zipimport>", line 259, in load_module                                                               
  File "/home/robert/ytdlp/yt_dlp/options.py", line 8, in <module>                                                  
  File "<frozen zipimport>", line 259, in load_module                                                               
  File "/home/robert/ytdlp/yt_dlp/compat.py", line 5, in <module>                                                   
  File "/home/robert/.pyenv/versions/3.9.5/lib/python3.9/ctypes/__init__.py", line 8, in <module>                   
    from _ctypes import Union, Structure, Array                                                                     
ImportError: libffi.so.7: cannot open shared object file: No such file or directory     

(you may notice a reference to pyenv in there!)

It seems there’s been an update to libffi, which has caused a corresponding bump in the library file number. Unfortunately, the latest (at time of writing) version/release of ctypes / yt-dlp hasn’t bumped the reference.

Fortunately, there’s a libffi7 package, which can be installed (from AUR) as a temporary workaround until other packages are updated.

Tell us what's on your mind

Discover more from Rob's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading