I am running MacOS High Sierra 10.13.6 and I think I have downloaded a version for PIL library (using brew install py3cairo
probably) that is not compatible with my OS. The computer has also pre-installed python2
.
I have installed ffmpeg
and I have it stored in documents; with some help, I have placed it in path so when I type in terminal:
>>> echo $PATH
the output is:
Users/imac/Documents/ffmpeg:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
My terminal's output when I run a simple program that is supposed to work (copy-paste from tutorial for manim):
Traceback (most recent call last):
...(omitted)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/Image.py", line 132, in <module>
from . import _imaging as core
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so,
2): Symbol not found: ____chkstk_darwin
Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/.dylibs/libtiff.5.dylib
(which was built for Mac OS X 11.0)
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/.dylibs/libtiff.5.dylib
I think I found a related topic Why is pip installing Pillow for OS X 10.12, when I have OS X 10.11 installed?
but I don't know if the answers apply to my case. I have python3
and Mac OS High Sierra 10.13.6. I suspect the 2nd answer may be more suitable but I still need guidance.
Problem solved :)
So the steps I followed were:
>>> pip3 uninstall Pillow
>>> brew install libjpeg libtiff little-cms2 openjpeg webp
>>> python3 -m pip install --upgrade pip
>>> python3 -m pip install --upgrade Pillow --no-binary :all:
Reasoning and more details can be found here: https://pillow.readthedocs.io/en/latest/installation.html#building-on-macos
Note: from the second answer of the linked post Why is pip installing Pillow for OS X 10.12, when I have OS X 10.11 installed? , I borrowed the 1st command for uninstalling.