-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failing to load Image from PIL in macOS with 9.4.0 #6862
Comments
Hi. What version of macOS are you using? |
Same issue with me |
For myself, it was Mojave 10.14.6. |
Also if helpful, I thought the DLC path when looking at the dependencies of the failing dylib curious as its invalid
|
Thanks. The problem was occurring for macOS < 11. python-pillow/pillow-wheels#358 has been merged to fix this for future Pillow wheels. If you would like an immediate solution, https://github.com/python-pillow/pillow-wheels/suites/10193756587/artifacts/499253201 has fixed wheels. |
I've uploaded new Pillow 9.4.0 wheels to PyPI. If you try installing from pip again, the problem should be fixed. |
Appreciate the quick response! Not sure how to tell when the wheel is updated, I tried to pip3 cache purge, installed 9.4.0 and got Pillow-9.4.0-1-cp38-cp38-macosx_10_10_x86_64.whl which has the same issue, but maybe not updated?
|
Pillow-9.4.0-1-cp38-cp38-macosx_10_10_x86_64.whl should be working. Could you uninstall Pillow, check that Pillow can't be imported, and then install again? |
I am having this issue today. New workspace, venv, install pillow, bam. Import error for As above, uninstalled pillow, then pip3 cache purge, then verified I could not import, before reinstalling pillow. Same error. |
I've created a zip of the new wheels from https://pypi.org/project/Pillow/#files. |
Unfortunately, GitHub Actions won't allow me to test 10.13 or 10.14. 10.15 works as far as I see - https://github.com/radarhere/Pillow/actions/runs/3870668581 |
Hi everyone, i am have also the same issue but with matplotlib (like you @jbeghtol i am Mojave 10.14.6) I have tried to uninstall/reinstall package on a new venv it doesn't work at all. |
If you download the wheels from the zip in my earlier comment, and |
i am currently downloading it, but excuse me for the noob question but can you tell me where i have to put the wheel downloaded file ? here is the complete code error returned by vscode : ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import matplotlib
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/__init__.py:113
109 from packaging.version import parse as parse_version
111 # cbook must import matplotlib only within function
112 # definitions, so it is safe to import from it here.
--> 113 from . import _api, _version, cbook, _docstring, rcsetup
114 from matplotlib.cbook import sanitize_sequence
115 from matplotlib._api import MatplotlibDeprecationWarning
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/rcsetup.py:27
25 from matplotlib import _api, cbook
26 from matplotlib.cbook import ls_mapper
---> 27 from matplotlib.colors import Colormap, is_color_like
28 from matplotlib._fontconfig_pattern import parse_fontconfig_pattern
29 from matplotlib._enums import JoinStyle, CapStyle
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/colors.py:51
49 from numbers import Number
50 import re
---> 51 from PIL import Image
52 from PIL.PngImagePlugin import PngInfo
54 import matplotlib as mpl
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py:103
94 MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)
97 try:
98 # If the _imaging C module is not present, Pillow will not load.
99 # Note that other modules should not refer to _imaging directly;
100 # import Image and use the Image.core variable instead.
101 # Also note that Image.core is not a publicly documented interface,
102 # and should be considered private and subject to change.
--> 103 from . import _imaging as core
105 if __version__ != getattr(core, "PILLOW_VERSION", None):
106 msg = (
107 "The _imaging extension was built for another version of Pillow or PIL:\n"
108 f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"
109 f"Pillow version: {__version__}"
110 )
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/libXdmcp.6.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib
Reason: no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown) |
Ask away. You don't need to put it anywhere. Once you have run the install command, you can get rid of it. So,
and then see if it works? I hope it does, but it is conceivable that it won't. |
Found existing installation: Pillow 9.4.0 I am not sure but it seems that i have the same version of Pillow |
Yes, proceed. |
i did, then : In terminal : then relaunched vscode --> trying to import matplotlib --> same error.... i am pretty desperate... @radarhere do you have any other ideas ? thanks by the way for the help |
It sounds like you have a different Python interpreter in VS Code compared to your terminal. Can you check them? On the terminal, what do you get for: python3 --version --version
which python3 I don't use VS Code, but can you check which Python you have running there? |
$ python3 --version --version
Python 3.10.7 (v3.10.7:6cc6b13308, Sep 5 2022, 14:02:52) [Clang 13.0.0 (clang-1300.0.29.30)]
$ which python3
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 |
I have certainly an issue with pillow because of this error message : File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/colors.py:51
49 from numbers import Number
50 import re
---> 51 from PIL import Image
52 from PIL.PngImagePlugin import PngInfo
54 import matplotlib as mpl |
|
From Terminal, are you able to run |
@radarhere Nope, here is the message Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 103, 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/libXdmcp.6.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib
Reason: no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown) |
Hmm. Thanks for that info. |
i got a new error :
does PIL and Pillow are two different package ? |
@radarhere when i try to install PIL (pip install PIL) here is the msg i got : ERROR: Could not find a version that satisfies the requirement PIL (from versions: none) |
Pillow is a fork of PIL. PIL hasn't had a new release in a long time, so I wouldn't try installing it. "The _imaging extension was built for another version" should just mean that you didn't properly uninstall one version of Pillow before installing another. Try uninstalling Pillow again, make sure that there is nothing called PIL or Pillow in "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/", and then try re-installing Pillow. |
Thanks to all for testing, and to @nulano for figuring this one out. I've uploaded new wheels to PyPI, so would anyone like to try uninstalling Pillow and then running |
@radarhere latest from PyPI works for me! Thanks!! |
- Fixed issue #12, by masking scores as well as boxes. - Added torch and torchvision as proper dev dependencies - Fixed Pillow version (dev dep) to 9.3.0 in dev dependencies because 9.4.0 does not compile on my mbp (see python-pillow/Pillow#6862) - Removed deprecated arguments: `cutoff_distance` and `tree`. Removed associated tests. - Added sanity check to ensure `leaf_size` is strictly positive.
Hi @radarhere I am running with the same error as @yacineCo importing matplotlib. I am running on a Mac M1 Mac OS Sonoma 14.2.1. I can't run any visualisation library (like seaborn or Matplotlib) I get a similar message like the one displayed before, except my file is the libtiff.5.dylib I try uninstalling the pillow library through Anaconda and it won't work, it stays running for ever, Would the pip method be effective here ( I was told not to mix pip and conda commands) this seems to be beyond my area of expertise, I am desperate and would appreciate any help!! thanks in advance!! |
@Dario-Montes What version of Pillow do you have installed? |
Could you post the complete error? |
Hi @radarhere and @nulano thanks for the quick reply. I have python version 3.11.0 and the complete error message is : ---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[3], line 3
1 # Visualization
2 #%matplotlib inline
----> 3 import matplotlib.pyplot as plt
4 import seaborn as sns
5 import plotly.express as px
File ~/anaconda3/lib/python3.11/site-packages/matplotlib/__init__.py:161
157 from packaging.version import parse as parse_version
159 # cbook must import matplotlib only within function
160 # definitions, so it is safe to import from it here.
--> 161 from . import _api, _version, cbook, _docstring, rcsetup
162 from matplotlib.cbook import sanitize_sequence
163 from matplotlib._api import MatplotlibDeprecationWarning
File ~/anaconda3/lib/python3.11/site-packages/matplotlib/rcsetup.py:27
25 from matplotlib import _api, cbook
26 from matplotlib.cbook import ls_mapper
---> 27 from matplotlib.colors import Colormap, is_color_like
28 from matplotlib._fontconfig_pattern import parse_fontconfig_pattern
29 from matplotlib._enums import JoinStyle, CapStyle
File ~/anaconda3/lib/python3.11/site-packages/matplotlib/colors.py:52
49 from numbers import Real
50 import re
---> 52 from PIL import Image
53 from PIL.PngImagePlugin import PngInfo
55 import matplotlib as mpl
File ~/anaconda3/lib/python3.11/site-packages/PIL/Image.py:82
73 MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)
76 try:
77 # If the _imaging C module is not present, Pillow will not load.
78 # Note that other modules should not refer to _imaging directly;
79 # import Image and use the Image.core variable instead.
80 # Also note that Image.core is not a publicly documented interface,
81 # and should be considered private and subject to change.
---> 82 from . import _imaging as core
84 if __version__ != getattr(core, "PILLOW_VERSION", None):
85 msg = (
86 "The _imaging extension was built for another version of Pillow or PIL:\n"
87 f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"
88 f"Pillow version: {__version__}"
89 )
ImportError: dlopen(/Users/dario/anaconda3/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libtiff.5.dylib
Referenced from: <865BA80B-4617-3103-AC5E-6873C17F99FD> /Users/dario/anaconda3/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so
Reason: tried: '/Users/dario/anaconda3/lib/python3.11/site-packages/PIL/../../../libtiff.5.dylib' (no such file), '/Users/dario/anaconda3/lib/python3.11/site-packages/PIL/../../../libtiff.5.dylib' (no such file), '/Users/dario/anaconda3/bin/../lib/libtiff.5.dylib' (no such file), '/Users/dario/anaconda3/bin/../lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file, not in dyld cache) Thanks again! |
Is that from the conda command or the pip command? If it is from conda, please provide the full line from the command output (i.e. including the build and channel columns). |
conda list
|
It looks like you've got libtiff installed from the conda-forge channel, but Pillow from the default channel. It is likely not a good idea to mix channels. See e.g. https://stackoverflow.com/a/67226436/1648883 Looking at previous issues (e.g. #7494 (comment)), something like |
I'm getting a similar error on macOS 10.10, with Python 3.12 and pillow==10.2.0
Now, 10.10 is truly ancient, so perhaps this is to be expected by now? What is the lowest macOS version that Pillow is expected to work on? |
The wheels are listed as "macosx_10_10", so they should still work on macOS 10.10. It would be interesting to know - does Pillow 10.1.0 work for you? My first thought would be my original solution to this - downgrading libXau to 1.0.10. I'm put together a wheel with that change - if you try installing pillow-10.3.0.dev0-cp312-cp312-macosx_10_10_x86_64.whl.zip, does that work? |
Ha, Pillow 10.1.0 indeed works on 10.10! |
But I'm afraid I'm getting the same error with your |
Thanks. We switched to using My next attempts are
Apologies that this might take quite a bit of trial and error. I don't have access to a macOS 10.10 machine, and GitHub Actions doesn't provide that environment either. |
The first one does not work, the second one does work indeed.
No worries, thanks for taking b/w compatibility seriously, and I'm glad I can help testing with my old old computer. |
Ok, I found that libxau was install by brew, and this one removes it and builds our own version instead - pillow-10.3.0.dev0-cp312-cp312-macosx_10_10_x86_64.whl.zip |
Seems to work! |
Thanks. I've created #7764 to fix this for the next Pillow release. If you would like a working wheel for a stable version of Pillow, here you go - pillow-10.2.0-cp312-cp312-macosx_10_10_x86_64.whl.zip |
Thank you so much! I'm so happy Pillow exists: I've been using PIL literally for decades. |
The missing libXau.dylib problem in Pillow 10.2.0 also effects macOS 10.14.6. Here is the error using homebrew python3.10. Glad to hear it will be fixed in the next Pillow release. Pillow 10.0.1 does not have the problem. $ uname -a
Darwin essex2.cgl.ucsf.edu 18.7.0 Darwin Kernel Version 18.7.0: Tue Jun 22 19:37:08 PDT 2021; root:xnu-4903.278.70~1/RELEASE_X86_64 x86_64
$ python3
Python 3.10.9 (main, Jan 6 2023, 01:54:24) [Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/chimera/Library/Python/3.10/lib/python/site-packages/PIL/Image.py", line 84, in <module>
from . import _imaging as core
ImportError: dlopen(/Users/chimera/Library/Python/3.10/lib/python/site-packages/PIL/_imaging.cpython-310-darwin.so, 2): Library not loaded: @loader_path/libXau.6.0.0.dylib
Referenced from: /Users/chimera/Library/Python/3.10/lib/python/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib
Reason: no suitable image found. Did find:
/Users/chimera/Library/Python/3.10/lib/python/site-packages/PIL/.dylibs/libXau.6.0.0.dylib: cannot load 'libXau.6.0.0.dylib' (load command 0x80000034 is unknown)
/Users/chimera/Library/Python/3.10/lib/python/site-packages/PIL/.dylibs/libXau.6.0.0.dylib: cannot load 'libXau.6.0.0.dylib' (load command 0x80000034 is unknown)
>>> |
Hi everyone I am sorry for not replying before. I solved all my issues by uninstalling anaconda and re-installing it. |
I have Mac OS 10.14 with python3.11 and pillow 10.2.0 and Matplotlib 3.8.3
|
We are currently using PIL on macOS inside a VENV to limit packaged. Today when we updated to 9.4.0 PIL stopped working on MacOS (these are x86_64 versions).
Steps to reproduce:
(note, some parts of the path were trimmed)
Have seen this on two different machines and it was reproducible on both after recreating a venv.
The text was updated successfully, but these errors were encountered: