Tensorflow crashing with libffi.so.6 error

Hello all,
I am trying to run tensor flow in Python 3.7.4 and TensorFlow 2.16.1. As soon as I try to import Tensorflow, it crashes with the following error -

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

I checked the version of libffi and it shows as follows -

/usr/lib/libffi.so.8.1.0
/usr/lib/libffi.so.8

I also tried to create a symlink, but I do not have the permissions to do it. Is there a way to solve this issue? Thank you very much!

-Shreya

1 Like

Unfortunately your Python version is too old. You need an environment which provides at least 3.9 and above. The required libraries are bundled with such an environment. You could use Docker or podman to create a container with such dependencies.

1 Like

Adding to previous comment, you’ll be better off following the tested configurations table:

Version Python version Compiler Build tools
tensorflow-2.16.1 3.9-3.12 Clang 17.0.6 Bazel 6.5.0

To me (without knowing Docker.) the easiest way to run a newer python is using mamba (conda miniforge3):

  1. Installing conda — conda 24.5.1.dev64 documentation
  2. Create your env with python 3.11 and pip
  3. Activate your env
  4. Install tensorflow using pip (as in the install guide.)
1 Like