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 5.1.0's included dylibs binaries stopped working on Mac El Capitan (10.11) #3068

Closed
varenc opened this issue Apr 4, 2018 · 42 comments
Labels
Anaconda Issues with Anaconda's Pillow macOS
Milestone

Comments

@varenc
Copy link

varenc commented Apr 4, 2018

What did you do?

Upgraded pillow from 5.0 to 5.1

What did you expect to happen?

For Pillow to keep working, or at least for the Pillow 5.1.0 change log to report that only 10.12+ is supported.

What actually happened?

When trying to use pillow through the python captcha package, I got this error:

  File ".../venv/lib/python3.6/site-packages/captcha/image.py", line 11, in <module>
    from PIL import Image
ImportError: .../venv/lib/python3.6/site-packages/PIL/_imaging.cpython-36m-darwin.so, 2): Symbol not found: _clock_gettime
Referenced from: .../venv/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib
 in .../venv/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib

What versions of Pillow and Python are you using?

Pillow 5.1.0 has the problem. Running Python 3.6.5.

To reproduce this problem try testing Pillow on a 10.11 system. Specifically, just import PIL.image to trigger this.

Installing pillow==5.0.0 fixed the issue.

Did you intentionally drop 10.11 support? If not it'd be great for this to keep working! Probably just means rebuilding the dylibs with 10.11 support.

If you meant to drop support than just clearer messaging around this would be helpful. (changelog, explicit version check and error message)

@wiredfool
Copy link
Member

That’s unintentional.

@matthew-brett ? @radarhere ?

@hugovk
Copy link
Member

hugovk commented Apr 4, 2018

Was it was caused by python-pillow/pillow-wheels#79 upgrading Xcode from version 8 to 9.2?

  • El Capitan 10.11 is the "min macOS to run" Xcode 8.

  • Sierra 10.12.6 is the min for Xcode 9.2.

https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_9.x_(since_Free_On-Device_Development)

@wiredfool
Copy link
Member

That does appear to fit the problem.

@varenc
Copy link
Author

varenc commented Apr 4, 2018

I'm no expert in this stuff, but it sounds like xcode9.2 simply defaults to building for 10.12, but you can still tell it to target older versions if you want.

I think you can do this by setting the MACOSX_DEPLOYMENT_TARGET=10.11 env which xcode will pick up!

@wiredfool
Copy link
Member

I’ve pushed a branch with the old Xcode, builds succeeded, so I think we’re back to a full OS X build.

Look here http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/ for pillow 5.1.0 builds, anything done on 4/4 is my test, and should work as far back as the previous release.

@varenc
Copy link
Author

varenc commented Apr 4, 2018

I can confirm this new .whl has me up and running with the latest Pillow now!

looking at liblzma.5.dylib with otool now shows that the LC_VERSION_MIN_MACOSX is 10.10. If you do want to take advantage of xcode 9 or support even older versions, tweaking MACOSX_DEPLOYMENT_TARGET might be the way to go, but happy things are working now. Thanks!

@wiredfool wiredfool added this to the 5.1.1 milestone Apr 4, 2018
@wiredfool
Copy link
Member

Ok, good to hear that it’s working. I think we’ll just stick with Xcode 6.4 for now, and do a 5.1.1 release shortly to fix the binaries.

@matthew-brett
Copy link
Contributor

How about releasing a binary build with a build tag?

https://github.com/MacPython/wiki/wiki/Build-Tags

It's just a question of building the wheels, downloading and renaming (see script on that page) and then uploading. Oh - and deleting the previous offending wheels.

@matthew-brett
Copy link
Contributor

I'm happy to help with the binary build ...

@jbarlow83
Copy link

I don't think it's a good idea to replace a known-bad version after it's been out for a while. Just bump the version.

People will be fixing their builds by blacklisting the bad release:

install_requires=['Pillow != 5.1.0 ; platform_system = "Darwin"']

jbarlow83 pushed a commit to ocrmypdf/OCRmyPDF that referenced this issue Apr 11, 2018
@varenc
Copy link
Author

varenc commented Apr 11, 2018

my two cents: If using build-tags lets you get the fixed 5.1.0 binaries out sooner then that seems preferable. But if 5.1.1 will get released soon anyway, then just go with that.

@wolph
Copy link

wolph commented Apr 11, 2018 via email

@matthew-brett
Copy link
Contributor

I can't see the downside to fixing the binaries. OK some people may be skipping the release, but they won't be further hurt by fixed binaries. If the bad version did anything special other than crash I'd agree, but replacing crash by no-crash seems like an easy win.

@hugovk
Copy link
Member

hugovk commented Apr 11, 2018

Please see #3089.

@hugovk
Copy link
Member

hugovk commented Apr 11, 2018

What's the best way to get pillow-wheels building on Xcode 8?

python-pillow/pillow-wheels#79 is the PR that upgraded from 8 to 9.2, because the latest multibuild was missing webp and upgrading fixed it.

Upgrading to the latest multibuild was needed because rsync was missing (with but perhaps not limited to 8): python-pillow/pillow-wheels#76.

@hugovk
Copy link
Member

hugovk commented Apr 11, 2018

To answer my own question, from upthread:

I’ve pushed a branch with the old Xcode, builds succeeded, so I think we’re back to a full OS X build.

Here's a PR, it's with Xcode 6.4: python-pillow/pillow-wheels#84.

@radarhere
Copy link
Member

Does anyone have any thoughts on what versions of macOS should be supported by pillow-wheels? We're talking about 10.11 here, so n-2? Or is it the case that we should just support as far back as we can without difficulty?

@wolph
Copy link

wolph commented Apr 12, 2018

I would personally say 10.10 and above but if it's easy to support I would go for all available.

If osx wouldn't have died on me a few years back I'd still be running 10.10. Newer versions have always broken more than they've fixed for me

@hugovk
Copy link
Member

hugovk commented Apr 12, 2018

I'd go for at least those supported by Apple, and further if there's no difference or not too much burden.

Let's go with Xcode 6.4 now, because it's the easiest to fix with that :) Xcode 6.4 should support at least as far back as 10.10.4 Yosemite.


Wikipedia gives these support statuses:

  • OS X 10.10 Yosemite: Unsupported as of September 2017, iTunes support to end in August 2018, similar to Mavericks.
  • OS X 10.11 El Capitan: Security updates and printer drivers only. Extended support to end this year, and iTunes support ends in next year.
  • macOS 10.12 Sierra: Extended support ends in September 2019 . iTunes, in August 2020.

Checking pip download stats for the last 30 days, very little for pre-10.10:

system_name distro_version percent download_count
Darwin 10.13.3 2.07% 23,200
Darwin 10.12.6 0.85% 9,528
Darwin 10.13.4 0.60% 6,743
Darwin 10.11.6 0.47% 5,293
Darwin 10.13.2 0.24% 2,707
Darwin 10.13.1 0.15% 1,695
Darwin 10.10.5 0.14% 1,527
Darwin 10.11.5 0.06% 674
Darwin 10.12.5 0.05% 508
Darwin 10.10 0.04% 499
Darwin 10.13 0.04% 479
Darwin None 0.03% 364
Darwin 10.12.4 0.03% 296
Darwin 10.12.3 0.02% 264
Darwin 10.12 0.02% 230
Darwin 10.9.5 0.02% 178
Darwin 10.12.1 0.01% 136
Darwin 10.11.4 0.01% 125
Darwin 10.12.2 0.01% 107
Darwin 10.13.5 0.01% 80
Darwin 10.11.3 0.01% 59
Darwin 10.11.2 0.00% 44
Darwin 10.11.1 0.00% 40
Darwin 10.10.3 0.00% 33
Darwin 10.11 0.00% 33
Darwin 10.14 0.00% 29
Darwin 10.13.6 0.00% 23
Darwin 10.7.5 0.00% 18
Darwin 10.10.4 0.00% 17
Darwin 10.8.5 0.00% 14
Darwin 10.10.2 0.00% 14
Darwin 10.10.1 0.00% 9
Darwin 10.6.8 0.00% 8
Darwin 6.1.4 0.00% 7
Darwin 10.15 0.00% 2
Darwin 10.9.4 0.00% 1
Darwin 10.90 0.00% 1
Darwin 10.3.1 0.00% 1
Darwin 9.1 0.00% 1
Darwin 10.9.2 0.00% 1
Darwin 10.9 0.00% 1
Darwin 10.8 0.00% 1

(via pypinfo --limit 1000 --percent --pip --markdown pillow system distro-version | grep Darwin)

@wiredfool
Copy link
Member

We're advertising support for 10.6 through 10.10, e.g.: Pillow-5.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Or, perhaps there's something subtle in the naming convention that I'm not getting. But it appears that the contents of the package don't match the naming.

I'd say that in general, we should support currently shipping systems in binary, and the long tail in source. For anything but windows, pillow isn't that hard to install from source for someone who's dedicated enough to be using an out of support operating system. Either that or they can step up with some cash or labor.

@matthew-brett
Copy link
Contributor

The naming pattern's a bit confusing I agree. It dates from the time when pip running on a Python naming itself 10.8 didn't accept a wheel with name > 10.8. That's long past now, so the name should just reflect the earliest OSX the wheel supports. What is that - on XCode 6.4?

I suggest using the earliest XCode available unless there's a good reason not to.

@wolph
Copy link

wolph commented Apr 12, 2018

Here's the version overview by major version (the minor ones aren't too relevant here I think):

Version Count Percent
10.03 1 0.00%
10.06 8 0.01%
10.07 18 0.03%
10.08 15 0.03%
10.09 182 0.33%
10.10 2099 3.84%
10.11 6268 11.48%
10.12 11069 20.27%
10.13 34927 63.95%
10.14 29 0.05%
10.15 2 0.00%

chosak added a commit to chosak/wagtail-inventory that referenced this issue Jun 11, 2018
This change adds support for Django 2.0 and Wagtail 2.0/2.1 to this
package. The README has been updated to reflect the change.

A `.coveragerc` file has been added to more helpfully limit test code
coverage and the test runner now dumps coverage to console for easier
reviewing. These changes also include a new test fixture for easier
testing of blocks.

Fixes cfpb#8.

To verify this change against Django 2.0 and Wagtail 2.0:

1. Create a new isolated virtualenv with Python 3.6 named `testwi`.

    ```
    $ mkvirtualenv --no-site-packages --python=python3.6 testwi
    ```

2. Install this PR into the virtualenv. Pulls in Wagtail/Django 2. This
open issue (python-pillow/Pillow#3068) means
that at least for now on Macs, you need to override the version of
Pillow that gets pulled in from those.

    ```sh
    $ pip install git+https://github.com/chosak/wagtail-inventory.git@wagtail-django-2
    $ pip install Pillow!=5.1.0
    ```

3. Create a new Wagtail project named `myproject`.

    ```sh
    $ wagtail start myproject
    $ cd myproject
    ```

4. Edit project settings to add modeladmin, the wagtail-inventory app
and its test app, along with Wagtail modeladmin, for access to a test
page class and block types.

    ```sh
    diff --git a/myproject/settings/base.py b/myproject/settings/base.py
    index fe5d391..7e8c232 100644
    --- a/myproject/settings/base.py
    +++ b/myproject/settings/base.py
    @@ -48,6 +48,8 @@ INSTALLED_APPS = [
         'django.contrib.sessions',
         'django.contrib.messages',
         'django.contrib.staticfiles',
    +
    +    'wagtail.contrib.modeladmin',
    +    'wagtailinventory',
    +    'wagtailinventory.tests.testapp',
     ]

     MIDDLEWARE = [
    ```

5. Create a database and a superuser.

    ```sh
    $ ./manage.py migrate
    $ ./manage.py createsuperuser
    ```

6. Run the `block_inventory` command to initialize the block table.

    ```sh
    $ ./manage.py block_inventory
    ```

7. Run your local server.

    ```sh
    $ ./manage.py runserver
    ```

9. Login to the admin at http://localhost:8000/admin/ with the superuser
you just created. Under Settings, Block Inventory you should see the two
default Wagtail pages. You shouldn't see any options in the dropdown
because the default pages don't include StreamField blocks.

10. Now we'll add a new page that does include StreamField blocks. In
the sidebar, click Pages, Home. Click the Add Child Page button and
choose one of the test page types, say "Multiple stream fields page".

Add some StreamField content, then click Save Draft.

11. If you go back to Settings, Block Inventory, you'll see that the
dropdown menus now include the block types that you included.

Play around with adding/deleting content from the page to see how the
inventory results change. Results should automatically be updated
whenever the page is saved.

Thanks to @alanmoo for contributing to these changes.
chosak added a commit to chosak/wagtail-inventory that referenced this issue Jun 11, 2018
This change adds support for Django 2.0 and Wagtail 2.0/2.1 to this
package. The README has been updated to reflect the change.

A `.coveragerc` file has been added to more helpfully limit test code
coverage and the test runner now dumps coverage to console for easier
reviewing. These changes also include a new test fixture for easier
testing of blocks.

Fixes cfpb#8.

To verify this change against Django 2.0 and Wagtail 2.0:

1. Create a new isolated virtualenv with Python 3.6 named `testwi`.

    ```
    $ mkvirtualenv --no-site-packages --python=python3.6 testwi
    ```

2. Install this PR into the virtualenv. Pulls in Wagtail/Django 2. This
open issue (python-pillow/Pillow#3068) means
that at least for now on Macs, you need to override the version of
Pillow that gets pulled in from those.

    ```sh
    $ pip install git+https://github.com/chosak/wagtail-inventory.git@wagtail-django-2
    $ pip install Pillow!=5.1.0
    ```

3. Create a new Wagtail project named `myproject`.

    ```sh
    $ wagtail start myproject
    $ cd myproject
    ```

4. Edit project settings to add modeladmin, the wagtail-inventory app
and its test app, along with Wagtail modeladmin, for access to a test
page class and block types.

    ```sh
    diff --git a/myproject/settings/base.py b/myproject/settings/base.py
    index fe5d391..7e8c232 100644
    --- a/myproject/settings/base.py
    +++ b/myproject/settings/base.py
    @@ -48,6 +48,8 @@ INSTALLED_APPS = [
         'django.contrib.sessions',
         'django.contrib.messages',
         'django.contrib.staticfiles',
    +
    +    'wagtail.contrib.modeladmin',
    +    'wagtailinventory',
    +    'wagtailinventory.tests.testapp',
     ]

     MIDDLEWARE = [
    ```

5. Create a database and a superuser.

    ```sh
    $ ./manage.py migrate
    $ ./manage.py createsuperuser
    ```

6. Run the `block_inventory` command to initialize the block table.

    ```sh
    $ ./manage.py block_inventory
    ```

7. Run your local server.

    ```sh
    $ ./manage.py runserver
    ```

9. Login to the admin at http://localhost:8000/admin/ with the superuser
you just created. Under Settings, Block Inventory you should see the two
default Wagtail pages. You shouldn't see any options in the dropdown
because the default pages don't include StreamField blocks.

10. Now we'll add a new page that does include StreamField blocks. In
the sidebar, click Pages, Home. Click the Add Child Page button and
choose one of the test page types, say "Multiple stream fields page".

Add some StreamField content, then click Save Draft.

11. If you go back to Settings, Block Inventory, you'll see that the
dropdown menus now include the block types that you included.

Play around with adding/deleting content from the page to see how the
inventory results change. Results should automatically be updated
whenever the page is saved.

Thanks to @alanmoo for contributing to these changes.
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Jun 22, 2018
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Jun 22, 2018
@hugovk
Copy link
Member

hugovk commented Sep 16, 2018

Please see issue python-pillow/pillow-wheels#96 and PR python-pillow/pillow-wheels#97 for necessary upgrades.

@denis-bz
Copy link

denis-bz commented Jan 2, 2023

Sorry, ignore this, noticed #6179 macos 10.14 service ended
too late.
Is there any way of telling pip "don't use that wheel for 10.14" ?

After pip install Pillow 9.4.0, matplotlib -> PIL ->
cannot load 'libXdmcp.6.dylib' (load command 0x80000034 is unknown)
Reinstall Pillow==9.3.0 works.

# matplotlib 3.6.2 -> PIL 9.4.0 on macos 10.14.6  2023-01-02
# https://github.com/python-pillow/Pillow/issues/3068 ?

import sys
import platform
import PIL

print( "mac_ver :", platform.mac_ver() )
print( "python sys.version :", sys.version )
print( "PIL.__version__ :", PIL.__version__ )

print( "\nimport matplotlib" )
import matplotlib

-->

mac_ver : ('10.14.6', ('', '', ''), 'x86_64')
python sys.version : 3.9.12 (v3.9.12:b28265d7e6, Mar 23 2022, 18:17:11)
[Clang 6.0 (clang-600.0.57)]
PIL.__version__ : 9.4.0

import matplotlib
Traceback (most recent call last):
  File "/Users/bz/etc/mac/mpl-pil-dylib.py", line 14, in <module>
    import matplotlib
  File "/opt/local/py/site/top/matplotlib/__init__.py", line 113, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "/opt/local/py/site/top/matplotlib/rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/opt/local/py/site/top/matplotlib/colors.py", line 51, in <module>
    from PIL import Image
  File "/opt/local/py/site/top/PIL/Image.py", line 103, in <module>
    from . import _imaging as core
ImportError: dlopen(/opt/local/py/site/top/PIL/_imaging.cpython-39-darwin.so, 2): Library not       loaded: @loader_path/libXdmcp.6.dylib
  Referenced from: /opt/local/py/site/top/PIL/.dylibs/libxcb.1.1.0.dylib
  Reason: no suitable image found.  Did find:
    /opt/local/py/site/top/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load       command 0x80000034 is unknown)
    /opt/local/py/site/top/PIL/.dylibs/libXdmcp.6.dylib: cannot load 'libXdmcp.6.dylib' (load       command 0x80000034 is unknown)

Xcode, otool --

xcode-select version 2354.

 54224 Jan  2 10:59 libXdmcp.6.dylib

otool -L libXdmcp.6.dylib
libXdmcp.6.dylib:
	/DLC/PIL/.dylibs/libXdmcp.6.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

@radarhere
Copy link
Member

Is there any way of telling pip "don't use that wheel for 10.14" ?

Since you already know how to pin to the previous version's wheel, I don't know what you're after. You'd like to be able to run the same command on macOS 10.14 and install Pillow 9.3, and on later macOS versions, install the latest Pillow?

@denis-bz
Copy link

denis-bz commented Jan 2, 2023

@radarhere, yes, exactly that: install the latest Pillow that works on my macOS.
"Pin to previous version": yes that's a fix
but after a pip install Pillow that looked ok: imho, an unforced error.

@radarhere
Copy link
Member

I'm guessing that the change was because python-pillow/pillow-wheels#350 updated libXau to 1.0.11. Homebrew removed support for 10.15 when making that update - Homebrew/homebrew-core@712726c

I can't even test macOS 10.14 on GitHub Actions to investigate further - https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

If you want to confirm my theory, you can test the wheels from https://github.com/radarhere/pillow-wheels/actions/runs/3825868768 - https://github.com/radarhere/pillow-wheels/suites/10148738168/artifacts/495813662. They are Pillow 9.4.0, but with libXau 1.0.10.

I don't think there's a way to adjust our wheels to work on macOS 10.14 without either removing or downgrading the dependency. You might be interested in building Pillow from source instead - pip install Pillow --no-binary :all:

@radarhere
Copy link
Member

More specifically, you can python3 -m pip install Pillow-9.4.0-cp39-cp39-macosx_10_10_x86_64.whl with
Pillow-9.4.0-cp39-cp39-macosx_10_10_x86_64.whl.zip

@radarhere
Copy link
Member

I've created python-pillow/pillow-wheels#357 as a possible solution to this. It downgrades the dependency for macOS < 11 and unfortunately 64-bit macOS >= 11 Python < 3.10, but otherwise keeps the latest version.

@denis-bz
Copy link

denis-bz commented Jan 4, 2023

@radarhere, thanks for taking the time to look at this; I should've recognized the problem (10.14) sooner, my fault.
It's I think a general problem for all macOS wheels:

  • Apple makes macOS upgrades difficult-to-impossible (planned obsolescence)
  • wheelbuilders can't test on old versions.

Any idea how other people e.g. conda handle this ?
A line in METADATA like External-requires = macos 10.15 would be useful --
if anybody checked it ...

@radarhere
Copy link
Member

The wheel you would have been downloading is Pillow-9.4.0-cp39-cp39-macosx_10_10_x86_64.whl. In my PR, I've found that the end of the wheel name can be macosx_11_0_x86_64.whl, meaning that the wheel would only be used on macOS >= 11, but from what I can see, that ending is only supported for Python 3.10 and 3.11.

This is making use of PEP 425. python3 -m pip debug --verbose will list other tags that can be used to specify what platforms a wheel will work on.

@radarhere
Copy link
Member

python-pillow/pillow-wheels#358 has been merged. Future Pillow wheels should work on macOS 10.14 again.

@radarhere
Copy link
Member

I've uploaded new Pillow 9.4.0 wheels. Installation should now work.

@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

10 participants