Skip to content

import PIL.Image double quotes for Core version: "9.2.0" on win-64 for python 3.7 and python 3.8 #6437

@skupr-anaconda

Description

@skupr-anaconda

What did you do?

I'm building Pillow 9.2.0 from the source code and after import PIL.Image on win-64 for python 3.7 and 3.8 tests failed

What did you expect to happen?

import PIL.Image on win-64 for python 3.7 and python 3.8 succeeds

What actually happened?

TEST START: output-artifacts\win-64\pillow-9.2.0-py37hdc2b20a_1.tar.bz2
Renaming work directory 'C:\ci\pillow_1657789265718\work' to 'C:\ci\pillow_1657789265718\work_moved_pillow-9.2.0-py37hdc2b20a_1_win-64'
shutil.move(work)=C:\ci\pillow_1657789265718\work, dest=C:\ci\pillow_1657789265718\work_moved_pillow-9.2.0-py37hdc2b20a_1_win-64)
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/win-64/libwebp-1.2.2-h2bbff1b_0.conda HTTP/1.1" 200 673648
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/win-64/lz4-c-1.9.3-h2bbff1b_1.conda HTTP/1.1" 200 134941
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/win-64/zstd-1.5.2-h19a0ad4_0.conda HTTP/1.1" 200 521566
DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/win-64/libtiff-4.2.0-he0120a3_1.conda HTTP/1.1" 200 771675

## Package Plan ##

  environment location: C:\ci\pillow_1657789265718\_test_env


The following NEW packages will be INSTALLED:

    ca-certificates: 2022.4.26-haa95532_0                                                                             
    certifi:         2022.6.15-py37haa95532_0                                                                         
    freetype:        2.10.4-hd328e21_0                                                                                
    jpeg:            9e-h2bbff1b_0                                                                                    
    libpng:          1.6.37-h2a8f88b_0                                                                                
    libtiff:         4.2.0-he0120a3_1                                                                                 
    libwebp:         1.2.2-h2bbff1b_0                                                                                 
    lz4-c:           1.9.3-h2bbff1b_1                                                                                 
    openssl:         1.1.1q-h2bbff1b_0                                                                                
    pillow:          9.2.0-py37hdc2b20a_1     file:///C:/ci/containers/00000f7bgd7/tmp/build/80754af9/output-artifacts
    pip:             22.1.2-py37haa95532_0                                                                            
    python:          3.7.13-h6244533_0                                                                                
    setuptools:      61.2.0-py37haa95532_0                                                                            
    sqlite:          3.38.5-h2bbff1b_0                                                                                
    tk:              8.6.12-h2bbff1b_0                                                                                
    vc:              14.2-h21ff451_1                                                                                  
    vs2015_runtime:  14.27.29016-h5e58377_2                                                                           
    wheel:           0.37.1-pyhd3eb1b0_0                                                                              
    wincertstore:    0.2-py37haa95532_2                                                                               
    xz:              5.2.5-h8cc25b3_1                                                                                 
    zlib:            1.2.12-h8cc25b3_2                                                                                
    zstd:            1.5.2-h19a0ad4_0                                                                                 

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
C:\ci\pillow_1657789265718\_test_env\lib\site-packages\PIL\Image.py:121: RuntimeWarning: The _imaging extension was built for another version of Pillow or PIL:
Core version: "9.2.0"
Pillow version: 9.2.0
  warnings.warn(str(v), RuntimeWarning)
Traceback (most recent call last):
  File "C:\ci\pillow_1657789265718\test_tmp\run_test.py", line 5, in <module>
    import PIL.Image
  File "C:\ci\pillow_1657789265718\_test_env\lib\site-packages\PIL\Image.py", line 104, in <module>
    "The _imaging extension was built for another version of Pillow or PIL:\n"
ImportError: The _imaging extension was built for another version of Pillow or PIL:
Core version: "9.2.0"
Pillow version: 9.2.0
Tests failed for pillow-9.2.0-py37hdc2b20a_1.tar.bz2 - moving package to C:\ci\broken
WARNING:conda_build.build:Tests failed for pillow-9.2.0-py37hdc2b20a_1.tar.bz2 - moving package to C:\ci\broken
set PREFIX=C:\ci\pillow_1657789265718\_test_env
set SRC_DIR=C:\ci\pillow_1657789265718\test_tmp

(base) %SRC_DIR%>call "%SRC_DIR%\conda_test_env_vars.bat" 

(base) %SRC_DIR%>set "CONDA_SHLVL="   && 

(base) %SRC_DIR%>conda activate "%PREFIX%" 

(%PREFIX%) %SRC_DIR%>IF 0 NEQ 0 exit /B 1 

(%PREFIX%) %SRC_DIR%>"%PREFIX%\python.exe" -s "%SRC_DIR%\run_test.py" 
import: 'PIL'
import: 'PIL.Image'

(%PREFIX%) %SRC_DIR%>IF 1 NEQ 0 exit /B 1 
TESTS FAILED: pillow-9.2.0-py37hdc2b20a_1.tar.bz2

What are your OS, Python and Pillow versions?

  • OS: win-64 (build tool: vs2017_win-64: 19.16.27032.1-hb4161e2_3)
  • Python: (CPython) 3.7 and 3.8
  • Pillow: 9.2.0

I think the bug is here:

Pillow/setup.py

Lines 849 to 856 in e42d8b0

if (
sys.platform == "win32"
and sys.version_info < (3, 9)
and not (PLATFORM_PYPY or PLATFORM_MINGW)
):
defs.append(("PILLOW_VERSION", f'"\\"{PILLOW_VERSION}\\""'))
else:
defs.append(("PILLOW_VERSION", f'"{PILLOW_VERSION}"'))

Because if I use defs.append(("PILLOW_VERSION", f'"{PILLOW_VERSION}"')) without double quotes for python 3.7 and 3.8 on win-64 it succeeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions