Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time

This traceback mess up all my program and I still cant fix it I have tried all methods and it didn't help!

Here's the problem:

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)
like image 525
Vethya Avatar asked Jun 30 '20 13:06

Vethya


3 Answers

This happens on some recent linux distributions - the binary wheel published on PyPI is not compatible with system libffi. Following will reinstall the package and build it locally on the system without using precompiled binaries published on PyPI:

pip install --force-reinstall --no-binary :all: cffi

PS: Installing libffi-dev (.deb based distros such as Ubuntu or Debian) or libffi-devel (.rpm based distros such as Fedora) might be needed before this.

like image 127
Michal Čihař Avatar answered Oct 03 '22 07:10

Michal Čihař


The problem also maybe be in a python version. I am using Fedora Linux, and it is always one python version ahead before gcloud. So I had python3.10 and then I installed supported by google-cloud-sdk python3.9 and pointed google-cloud-sdk to that version of python by adding a new path to .bashrc: export CLOUDSDK_PYTHON=python3.9

like image 23

I just did an upgrade and now the error dissapeared:

pip install --upgrade cffi xcffib

You might have to use su (or sudo su) before actually doing the update depending on what packages setup you want to target.

PS: I'm on Ubuntu so I used su before actually doing the upgrade

like image 27
adrhc Avatar answered Oct 03 '22 06:10

adrhc