I'm attempting to simply import the matplotlib module into my version of Python3 (3.10) on MacOS Big Sur.
However, when I simply try to import matplotlib, I get the following error:
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/__init__.py", line 113, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/colors.py", line 51, in <module>
from PIL import Image
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 100, in <module>
from . import _imaging as core
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so, 2): Library not loaded: @loader_path/.dylibs/libtiff.5.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so
Reason: Incompatible library version: _imaging.cpython-310-darwin.so requires version 14.0.0 or later, but libtiff.5.dylib provides version 10.0.0
I've tried uninstalling and reinstalling matplotlib and libtiff, as well as trying to install matplotlib in a different python virtual environment - nothing seems to work.
I found this link which has my exact error message, but as far as I can tell involves a completely different app (Inkscape vs. matplotlib), and the fix seems to be installing a different version of Inkscape. To me, this didn't seem relevant, and none of the other solutions found after googling seemed to work for my specific situation. Any ideas?