Skip to content

SystemError: ffi_prep_closure(): bad user_data #2

@amstelchen

Description

@amstelchen

Problem:

$ GameInfo
Traceback (most recent call last):
  File "/home/mic/.local/bin/GameInfo", line 8, in <module>
    sys.exit(main())
  File "/home/mic/.local/lib/python3.9/site-packages/gameinfo/__main__.py", line 5, in main
    app = Application()           
  File "/home/mic/.local/lib/python3.9/site-packages/gameinfo/GameInfo.py", line 101, in __init__
    self.updateWidgets(textPane="Tools") # was "Machine"
  File "/home/mic/.local/lib/python3.9/site-packages/gameinfo/GameInfo.py", line 111, in updateWidgets
    self.fillTreeview(textPane)
  File "/home/mic/.local/lib/python3.9/site-packages/gameinfo/GameInfo.py", line 370, in fillTreeview
    image_data = cairosvg.svg2png(url=image_filename)
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/__init__.py", line 55, in svg2png
    return surface.PNGSurface.convert(
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/surface.py", line 131, in convert
    instance = cls(
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/surface.py", line 223, in __init__
    self.draw(tree)
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/surface.py", line 469, in draw
    self.draw(child)
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/surface.py", line 469, in draw
    self.draw(child)
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/surface.py", line 401, in draw
    TAGS[node.tag](self, node)
  File "/home/mic/.local/lib/python3.9/site-packages/cairosvg/image.py", line 86, in image
    image_surface = cairo.ImageSurface.create_from_png(png_file)
  File "/home/mic/.local/lib/python3.9/site-packages/cairocffi/surfaces.py", line 782, in create_from_png
    read_func = _make_read_func(source)
  File "/home/mic/.local/lib/python3.9/site-packages/cairocffi/surfaces.py", line 31, in _make_read_func
    def read_func(_closure, data, length):
SystemError: ffi_prep_closure(): bad user_data (it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time)

$ pip show cffi
Name: cffi
Version: 1.15.1
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
Author-email: python-cffi@googlegroups.com
License: MIT
Location: /home/mic/.local/lib/python3.9/site-packages
Requires: pycparser
Required-by: cairocffi, gameinfo

Solution:

$ sudo apt install libffi-dev
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
libffi-dev ist schon die neueste Version (3.3-6).

$ pip install --force-reinstall --no-binary :all: cffi
Defaulting to user installation because normal site-packages is not writeable
Collecting cffi
  Downloading cffi-1.15.1.tar.gz (508 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 508.5/508.5 kB 2.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting pycparser
  Downloading pycparser-2.21.tar.gz (170 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 170.9/170.9 kB 1.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Skipping wheel build for cffi, due to binaries being disabled for it.
Skipping wheel build for pycparser, due to binaries being disabled for it.
Installing collected packages: pycparser, cffi
  Attempting uninstall: pycparser
    Found existing installation: pycparser 2.21
    Uninstalling pycparser-2.21:
      Successfully uninstalled pycparser-2.21
  Running setup.py install for pycparser ... done
  Attempting uninstall: cffi
    Found existing installation: cffi 1.15.1
    Uninstalling cffi-1.15.1:
      Successfully uninstalled cffi-1.15.1
  Running setup.py install for cffi ... done
Successfully installed cffi-1.15.1 pycparser-2.21

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions