matplotlib error in Thonny 4.1.4 - invalid ELF header

10 views
Skip to first unread message

Snake Thumper

unread,
Sep 5, 2025, 12:43:04 AMSep 5
to thonny

Hi

I'm getting this error on Thonny 4.1.4 when i try to import matplotlib in Thonny 4.1.4 on Raspberry Pi 4B. (Other imports, such as pyaudio, work ok)

import matplotlib

Traceback (most recent call last):
File "/home/david/Documents/TestMatPlotLib.py", line 8, in
import matplotlib
File "/usr/lib/python3/dist-packages/matplotlib/init.py", line 113, in
from . import _api, _version, cbook, _docstring, rcsetup
File "/usr/lib/python3/dist-packages/matplotlib/rcsetup.py", line 27, in
from matplotlib.colors import Colormap, is_color_like
File "/usr/lib/python3/dist-packages/matplotlib/colors.py", line 51, in
from PIL import Image
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 103, in
from . import _imaging as core
ImportError: /lib/aarch64-linux-gnu/libwebp.so.7: invalid ELF header

I'm a relative newbie to Pi. I've checked and matplotlib is installed (v3.6.3). There seems to be a later version of Thonny 4.1.7 which might possibly fix this, but i have no idea how to install it without a venv. (i dont need or want a venv)

Can anyone point me in the right direction? Any help much appreciated!

Reply all
Reply to author
Forward
0 new messages