You are not logged in.

#1 2021-10-21 00:56:18

redshoe
Member
Registered: 2015-12-16
Posts: 250

[Solved] Python matplotlib error regarding new libffi version

Recent update of the system crippled the python module of matplotlib. I think the system updated the libffi (from version 7 to 8) and the matplotlib is seem to be looking for version 7. So, I created a symbolic link of libffi.so.7 to libffi.so.8, and it is still not working... (I know this is a hacky solution..).

Below is the error message

Traceback (most recent call last):
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/matplotlib/backends/backend_gtk3.py", line 17, in <module>
    import gi
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/gi/__init__.py", line 40, in <module>
    from . import _gi
ImportError: /usr/lib/libffi.so.8: version `LIBFFI_BASE_7.0' not found (required by /home/rangke/py_vrt/lib/python3.9/site-packages/gi/_gi.cpython-39-x86_64-linux-gnu.so)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/rangke/work/sa/scr/blob.timesrs.py", line 4, in <module>
    import matplotlib.pyplot as plt
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/matplotlib/pyplot.py", line 2336, in <module>
    switch_backend(rcParams["backend"])
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/matplotlib/pyplot.py", line 276, in switch_backend
    class backend_mod(matplotlib.backend_bases._Backend):
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/matplotlib/pyplot.py", line 277, in backend_mod
    locals().update(vars(importlib.import_module(backend_name)))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/matplotlib/backends/backend_gtk3agg.py", line 8, in <module>
    from . import backend_agg, backend_gtk3
  File "/home/rangke/py_vrt/lib/python3.9/site-packages/matplotlib/backends/backend_gtk3.py", line 19, in <module>
    raise ImportError("The GTK3 backends require PyGObject") from err
ImportError: The GTK3 backends require PyGObject

I tried re-creating the virtual environment from the scratch, and I am still getting the same error.

Help....?!

Last edited by redshoe (2021-10-24 13:56:52)

Offline

#2 2021-10-21 06:45:16

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,271

Re: [Solved] Python matplotlib error regarding new libffi version

Symlinking is not "a hacky solution", it's not a solution at all and a very bad idea, so start by removing it. The problem is in the gobject copy in your venv, you need to rebuild that.

Offline

#3 2021-10-21 10:07:38

robson75
Member
From: Poland
Registered: 2020-06-28
Posts: 144

Re: [Solved] Python matplotlib error regarding new libffi version

You probably have the python2-gobject2 package installed on your system which is located in AUR, you just need to rebuild it.


Arch Linux Xfce - 64Bit Linux User #621110

Offline

#4 2021-10-21 16:14:43

redshoe
Member
Registered: 2015-12-16
Posts: 250

Re: [Solved] Python matplotlib error regarding new libffi version

arojas wrote:

Symlinking is not "a hacky solution", it's not a solution at all and a very bad idea, so start by removing it. The problem is in the gobject copy in your venv, you need to rebuild that.

Okay, I'll never do that again.

I solved the issue by clearing the pip cache and re-doing the python environment. Thanks!

Offline

Board footer

Powered by FluxBB