What did you do?
on vanilla macOS with xcode and necessary prerequisites installed (as static libraries), run
python3 setup.py install && python3 -c "from PIL import Image"
What did you expect to happen?
The import should be successful.
What actually happened?
Core version: None
Pillow version: 8.1.2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<frozen zipimport>", line 259, in load_module
File "...../lib/python3.8/site-packages/Pillow-8.1.2-py3.8-macosx-10.15-x86_64.egg/PIL/Image.py", line 97, in <module>
ImportError: The _imaging extension was built for another version of Pillow or PIL:
Core version: None
Pillow version: 8.1.2
The real cause is not because the _imaging.so native module is compiled for another version (as we just built it), but because Python is unable to dlopen it at all.
What are your OS, Python and Pillow versions?
- OS: macOS 10.15
- Python: 3.8.8
- Pillow: 8.1.2
Suspected Cause
We specified zip_safe to be generally True unless it's a debugging build or mingw build.
|
zip_safe=not (debug_build() or PLATFORM_MINGW), |
However, Python is unable to import a dynamic library from a zip file. Therefore, this package should definitely not be labeled zip_safe. I have checked many installations, and on many,easy_install somehow knows to extract the content of the egg into its a directory, thus hiding this issue on lots of platforms. I'm not yet sure why this doesn't happen on macOS. But nevertheless, I don't think we should use zip_safe: True on any platform: as https://docs.python.org/3/library/zipimport.html explicitly disallows importing dynamic modules.
What did you do?
on vanilla macOS with xcode and necessary prerequisites installed (as static libraries), run
What did you expect to happen?
The import should be successful.
What actually happened?
The real cause is not because the
_imaging.sonative module is compiled for another version (as we just built it), but because Python is unable todlopenit at all.What are your OS, Python and Pillow versions?
Suspected Cause
We specified
zip_safeto be generallyTrueunless it's a debugging build or mingw build.Pillow/setup.py
Line 912 in 51bbefe
However, Python is unable to import a dynamic library from a zip file. Therefore, this package should definitely not be labeled
zip_safe. I have checked many installations, and on many,easy_installsomehow knows to extract the content of the egg into its a directory, thus hiding this issue on lots of platforms. I'm not yet sure why this doesn't happen on macOS. But nevertheless, I don't think we should usezip_safe: Trueon any platform: as https://docs.python.org/3/library/zipimport.html explicitly disallows importing dynamic modules.