Skip to content
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

Pillow 9.0.1 crash: symbol not found in flat namespace '_xcb_connect' (Darwin M1) #6015

Closed
ajslater opened this issue Feb 3, 2022 · 18 comments
Labels
Anaconda Issues with Anaconda's Pillow macOS

Comments

@ajslater
Copy link

ajslater commented Feb 3, 2022

What did you do?

Using Pillow 9.0.0 in python project. Works great as usual.
Installed Pillow 9.0.1
Ran a python program that imports PIL

What did you expect to happen?

Perform much the same as Pillow 9.0.0

What actually happened?

Crashes on import:

    from . import _imaging as core
ImportError: dlopen(/Users/aj/Code/codex/.venv/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_xcb_connect'

What are your OS, Python and Pillow versions?

  • OS: macOS 12.2 (M1)
  • Python: 3.9.10
  • Pillow: 9.0.1

Offending code

from PIL import Image

Reverting to 9.0.0 fixes the issue. Easy workaround for now.

hombrew has libxcb installed:
libxcb: stable 1.14 (bottled)

Could be a problem with the binary wheel for M1

@radarhere radarhere added the macOS label Feb 3, 2022
@radarhere
Copy link
Member

Works great as usual.

Quick aside: thanks for these kind words!

How did you actually install Pillow? pip?

@ajslater
Copy link
Author

ajslater commented Feb 3, 2022 via email

@victorbenichoux
Copy link

Hi!

I confirm that installing pillow==0.0.1 through pip leads to the same issue on the same os/hardware!

I can also confirm it works (great as usual) with pillow==9.0.0.

@hugovk
Copy link
Member

hugovk commented Feb 3, 2022

Could be a problem with the binary wheel for M1

Does 9.0.1 work when installed from sdist/GitHub source?

@hugovk
Copy link
Member

hugovk commented Feb 3, 2022

Pillow source changes:

Wheel builder changes:

@louisstuart96
Copy link

louisstuart96 commented Feb 3, 2022

Could be a problem with the binary wheel for M1

Does 9.0.1 work when installed from sdist/GitHub source?

I have experienced the same crash as @ajslater : the environment is exactly the same, installed Pillow==9.0.1 via pip and crashed, revert to 9.0.0 and fixed.

In a newly created virtual environment I tried installing from source and it works fine as usual:

> pip install .
Looking in indexes: ****
Processing /Users/***/Desktop/Pillow-9.0.1
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for Pillow, since package 'wheel' is not installed.
Installing collected packages: Pillow
  Running setup.py install for Pillow ... done
Successfully installed Pillow-9.0.1

Did not crash on importing.

sha256sum hash of newly built library file:

1821b087ca27e013c080ce8c8b7f7db902fce29db6cbecd74d1fb9e41e39c997  /Users/***/testenv/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so

and all the external libraries on which Pillow depends are installed via Homebrew.

sha256sum hash of buggy library:

0f9e5ce81771dc077f381d2159f82c2604a7199fb2ab663ca5083273a847dc76  /Users/***/testenv/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so

@nulano
Copy link
Contributor

nulano commented Feb 3, 2022

Actually, I think this is a change in the GHA image for MacOS, triggered by an update to some unrelated package on brew (IIRC that was the cause when this happened previously).

Comparing the wheels, 9.0.1 has an additional dylib, and the X related dylibs have different permissions, suggesting they were not built by pillow-wheels but come from a different source:

Pillow 9.0.0:
image

Pillow 9.0.1:
image

@pmh722
Copy link

pmh722 commented Feb 3, 2022

+1 cannot install matplotlib on M1 Mac this morning. Pinning to 9.0 works. Thanks.

@nulano
Copy link
Contributor

nulano commented Feb 3, 2022

I have created python-pillow/pillow-wheels#249 with a potential fix.

A build of Pillow with this change is available here if someone would like to test it (download wheels or wheels-latest, then pip install the appropriate wheel for your platform): https://github.com/nulano/pillow-wheels/actions/runs/1790264094

@radarhere
Copy link
Member

python-pillow/pillow-wheels#249 has been merged, and I've uploaded the M1 wheels to PyPI with a build number.

This should be fixed now, but if someone else would like to confirm?

@abey79
Copy link
Contributor

abey79 commented Feb 4, 2022

I've had the same issue but 9.0.1-1 works for me 👍🏻 (FWIW, I'm not using Homebrew but MacPorts)

@ajslater
Copy link
Author

ajslater commented Feb 4, 2022

Still seems broken for me. Cleared my poetry cache of the wheels before trying again just now.
Darwin M1, homebrew.

@radarhere
Copy link
Member

@ajslater could you try this and let us know if it works?

python3.9 -m pip install --force-reinstall https://files.pythonhosted.org/packages/34/4e/a491038f9bb13ea7f69874789d2cb69577eefb16724d678602f42222128f/Pillow-9.0.1-1-cp39-cp39-macosx_11_0_arm64.whl

@ajslater
Copy link
Author

ajslater commented Feb 4, 2022

Hey that does work! Thanks for the suggestion, @radarhere. I used the poetry equivalent.
Do you reckon this wheel just takes a little while to propagate past pypi caches?

Nice work @nulano

@radarhere
Copy link
Member

Cool.

I'm not familiar with poetry, but PyPI itself shouldn't have this much of a delay. PyPI won't let us replace the original wheel, only add additional wheels with different build numbers. So we have followed PyPI's plan for what to do in this situation, and it should stop the influx of new users experiencing this problem.

@ajslater
Copy link
Author

ajslater commented Feb 4, 2022

Nuked all my pip & poetry caches, destroyed my venv and installed from pypi and now it works. Thanks all.

@ajslater ajslater closed this as completed Feb 4, 2022
@WittmannF
Copy link

pip uninstall pillow followed by conda install pillow worked for me.

@johncronan
Copy link

Installed before the fix, and I'm using poetry. Here's what I used:

poetry cache clear pypi --all
poetry update
pip uninstall pillow
poetry install

cjdsellers added a commit to nautechsystems/nautilus_trader that referenced this issue Feb 11, 2022
- Fix `pillow` error on ARM_64
- python-pillow/Pillow#6015.
@aclark4life aclark4life added the Anaconda Issues with Anaconda's Pillow label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anaconda Issues with Anaconda's Pillow macOS
Projects
None yet
Development

No branches or pull requests