conda-forge / pillow-feedstock

A conda-smithy repository for pillow.
BSD 3-Clause "New" or "Revised" License
2 stars 30 forks source link

Downgrading Python from 3.11 to 3.10 breaks PIL on Mac #136

Closed ChrisBarker-NOAA closed 1 year ago

ChrisBarker-NOAA commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

If you install PIllow with Python 3.11, it works fine.

conda create -n junk python=3.11 pillow

But if you downgrade python:

conda insatall python=3.10

You get a pillow built for py3.10:

$ conda list pillow
# packages in environment at /Users/chris.barker/miniconda3/envs/junk:
#
# Name                    Version                   Build  Channel
pillow                    9.4.0           py310hcec6c5f_0 

But it's broken:

$ python -c "from PIL import Image"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/chris.barker/miniconda3/envs/junk/lib/python3.10/site-packages/PIL/Image.py", line 103, in <module>
    from . import _imaging as core
ImportError: dlopen(/Users/chris.barker/miniconda3/envs/junk/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so, 2): Library not loaded: @rpath/libtiff.5.dylib
  Referenced from: /Users/chris.barker/miniconda3/envs/junk/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so
  Reason: image not found

If you start your environment with Python 3.10 in the first place, it works fine.

In general, changing Python version can be fraught, but I think this should work.

Note that if I start with py310, I get a newer build:

pillow                    9.4.0           py310h306a057_1    conda-forge

Maybe build 0 should be marked as broken?

Installed packages

$ conda list
# packages in environment at /Users/chris.barker/miniconda3/envs/junk:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h0d85af4_4    conda-forge
ca-certificates           2022.12.7            h033912b_0    conda-forge
freetype                  2.12.1               h3f81eb7_1    conda-forge
giflib                    5.2.1                hbcb3906_2    conda-forge
jpeg                      9e                   hb7f2c08_3    conda-forge
lcms2                     2.14                 h29502cd_1    conda-forge
lerc                      4.0.0                hb486fe8_0    conda-forge
libcxx                    15.0.7               h71dddab_0    conda-forge
libdeflate                1.17                 hac1461d_0    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libpng                    1.6.39               ha978bb4_0    conda-forge
libsqlite                 3.40.0               ha978bb4_0    conda-forge
libtiff                   4.5.0                hee9004a_2    conda-forge
libwebp                   1.2.4                h70a068d_1    conda-forge
libwebp-base              1.2.4                h775f41a_0    conda-forge
libxcb                    1.13              h0d85af4_1004    conda-forge
libzlib                   1.2.13               hfd90126_4    conda-forge
ncurses                   6.3                  h96cf925_1    conda-forge
openjpeg                  2.5.0                h13ac156_2    conda-forge
openssl                   3.0.8                hfd90126_0    conda-forge
pillow                    9.4.0           py310hcec6c5f_0  
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pthread-stubs             0.4               hc929b4f_1001    conda-forge
python                    3.10.9          he7542f4_0_cpython    conda-forge
readline                  8.1.2                h3899abd_0    conda-forge
setuptools                67.4.0             pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h5dbffcc_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.9                h35c211d_0    conda-forge
xorg-libxdmcp             1.1.3                h35c211d_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
zlib                      1.2.13               hfd90126_4    conda-forge
zstd                      1.5.2                hbc0c0cd_6    conda-forge

Environment info

$ conda info

     active environment : junk
    active env location : /Users/chris.barker/miniconda3/envs/junk
            shell level : 2
       user config file : /Users/chris.barker/.condarc
 populated config files : /Users/chris.barker/.condarc
          conda version : 23.1.0
    conda-build version : not installed
         python version : 3.8.13.final.0
       virtual packages : __archspec=1=x86_64
                          __osx=10.16=0
                          __unix=0=0
       base environment : /Users/chris.barker/miniconda3  (writable)
      conda av data dir : /Users/chris.barker/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/NOAA-ORR-ERD/osx-64
                          https://conda.anaconda.org/NOAA-ORR-ERD/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/chris.barker/miniconda3/pkgs
                          /Users/chris.barker/.conda/pkgs
       envs directories : /Users/chris.barker/miniconda3/envs
                          /Users/chris.barker/.conda/envs
               platform : osx-64
             user-agent : conda/23.1.0 requests/2.27.1 CPython/3.8.13 Darwin/20.6.0 OSX/10.16
                UID:GID : 1048720323:1806393361
             netrc file : None
           offline mode : False
h-vetinari commented 1 year ago
openssl                   3.0.8                hfd90126_0    conda-forge
pillow                    9.4.0           py310hcec6c5f_0  
pip                       23.0.1             pyhd8ed1ab_0    conda-forge

You're using a pillow not from conda-forge. Please use strict channel priority.

ocefpaf commented 1 year ago

@ChrisBarker-NOAA, lately we are even recommending folks to remove the defaults channel entirely to avoid conflicts. It is quite safe to use one or the other but not both together.

ChrisBarker-NOAA commented 1 year ago

Thanks -- I really thought I had strict set :-(

But good idea to just try removing defaults!