Skip to content

Build fails under Cygwin with Python 3.9.16 and false "jpeg not found" message #7158

Description

@ipa-bak

What did you do?

Tried to install Pillow via pip pip install Pillow

Then tried to git clone and install via pip install -e . from latest source in a fresh and clean virtual environment

What did you expect to happen?

Clean download, compile and install

What actually happened?

install errored out:

The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.

Potentially related issues:

What are your OS, Python and Pillow versions?

  • OS: windows 10, Cygwin (latest update from today, 2023-05-11)
  • Python: 3.9.16
  • Pillow: 1.7.6-14728-g8874549a9

Full Python version:

$ Python
Python 3.9.16 (main, Mar  8 2023, 22:47:22)
[GCC 11.3.0] on cygwin

Potentially relevant Cygwin package versions:

cygwin    3.4.6-1
cygwin-devel    3.4.6-1
base-cygwin    3.8-2
gcc-g++    11.3.0-1
python-pip-wheel    19.2.3-1
python-setuptools-wheel    0.37.1-1
python3    3.9.10-1
python3-devel    3.9.10-1
python39    3.9.16-1
python39-cython    0.29.33-1
python39-devel    3.9.16-1
python39-packaging    21.3-1
python39-pkgconfig    1.5.5.-1
python39-setuptools    67.6.0-1
python39-virtualenv    20.21.0-1
python39-wheel    0.38.4-1
python39-imaging    8.4.0-1
pkg-config    1.9.5-1
pkgconf    1.9.5-1
jpeg    2.1.5.1-1
libjpeg-devel    2.1.5.1-1
libjpeg8    2.1.5.1-1
libopenjpeg-devel    1.5.2-3
libopenjpeg1    1.5.2-3
openjpeg    1.5.2-3
openjpeg2    2.5.0-1
zlib-devel    1.2.13-1
zlib0    1.2.13-1
libtiff6    4.4.0-1
libtiff7    4.5.0-1
libfreetype6    2.13.0-1
liblcms2_2    2.15-1
libwebp7    1.3.0-1
libimagequant0    2.10.0-1
libraqm0    0.7.0-1

Steps to reproduce

See also script below.

  • Setup a minimal Cygwin environment with packages as listed above.
  • Create a virtual python environment virtualenv-3.9 pillow-tst
  • Activate virtual environment. Within run pip install pillow

Script try-build-pillow.sh:

#! /bin/bash

stamp="$(date +%Y-%m-%d_%H%M%S)"
base="pillow-tmp"
full="${base}_${stamp}"

virtualenv-3.9 "${full}"
pushd "${full}" || exit 1
. bin/activate
pip --version
python --version
pip install pillow
popd

Script output

 ./try-build-pillow.sh
created virtual environment CPython3.9.16.final.0-64 in 2512ms
  creator CPython3Posix(dest=/home/bak/pillow-tmp_2023-05-11_155517, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/bak/.local/share/virtualenv)
    added seed packages: pip==23.0.1, setuptools==67.6.1, wheel==0.40.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
~/pillow-tmp_2023-05-11_155517 ~
pip 23.0.1 from /home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/pip (python 3.9)
Python 3.9.16
Collecting pillow
  Using cached Pillow-9.5.0.tar.gz (50.5 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pillow
  Building wheel for pillow (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [189 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.cygwin-3.4.6-x86_64-cpython-39
      creating build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/BdfFontFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/BlpImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/BmpImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/BufrStubImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ContainerIO.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/CurImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/DcxImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/DdsImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/EpsImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ExifTags.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/features.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/FitsImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/FitsStubImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/FliImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/FontFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/FpxImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/FtexImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/GbrImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/GdImageFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/GifImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/GimpGradientFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/GimpPaletteFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/GribStubImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/Hdf5StubImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/IcnsImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/IcoImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/Image.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageChops.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageCms.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageColor.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageDraw.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageDraw2.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageEnhance.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageFilter.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageFont.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageGrab.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageMath.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageMode.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageMorph.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageOps.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImagePalette.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImagePath.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageQt.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageSequence.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageShow.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageStat.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageTk.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageTransform.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImageWin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/ImtImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/IptcImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/Jpeg2KImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/JpegImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/JpegPresets.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/McIdasImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/MicImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/MpegImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/MpoImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/MspImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PaletteFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PalmImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PcdImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PcfFontFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PcxImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PdfImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PdfParser.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PixarImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PngImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PpmImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PsdImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PSDraw.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/PyAccess.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/QoiImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/SgiImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/SpiderImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/SunImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/TarIO.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/TgaImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/TiffImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/TiffTags.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/WalImageFile.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/WebPImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/WmfImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/XbmImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/XpmImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/XVThumbImagePlugin.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/_binary.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/_deprecate.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/_tkinter_finder.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/_util.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/_version.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/__init__.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      copying src/PIL/__main__.py -> build/lib.cygwin-3.4.6-x86_64-cpython-39/PIL
      running egg_info
      writing src/Pillow.egg-info/PKG-INFO
      writing dependency_links to src/Pillow.egg-info/dependency_links.txt
      writing requirements to src/Pillow.egg-info/requires.txt
      writing top-level names to src/Pillow.egg-info/top_level.txt
      reading manifest file 'src/Pillow.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.c'
      warning: no files found matching '*.h'
      warning: no files found matching '*.sh'
      warning: no files found matching '*.txt'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.clang-format'
      warning: no previously-included files found matching '.coveragerc'
      warning: no previously-included files found matching '.editorconfig'
      warning: no previously-included files found matching '.readthedocs.yml'
      warning: no previously-included files found matching 'codecov.yml'
      warning: no previously-included files found matching 'renovate.json'
      warning: no previously-included files matching '.git*' found anywhere in distribution
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.so' found anywhere in distribution
      no previously-included directories found matching '.ci'
      adding license file 'LICENSE'
      writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
      running build_ext


      The headers or library files could not be found for jpeg,
      a required dependency when compiling Pillow from source.

      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html

      Traceback (most recent call last):
        File "/tmp/pip-install-2bvhmusu/pillow_2fb74b21c9a04782b3dade7d8d874d33/setup.py", line 993, in <module>
          setup(
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/home/bak/pillow-tmp_2023-05-11_155517/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-install-2bvhmusu/pillow_2fb74b21c9a04782b3dade7d8d874d33/setup.py", line 809, in build_extensions
          raise RequiredDependencyException(f)
      __main__.RequiredDependencyException: jpeg

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-2bvhmusu/pillow_2fb74b21c9a04782b3dade7d8d874d33/setup.py", line 1010, in <module>
          raise RequiredDependencyException(msg)
      __main__.RequiredDependencyException:

      The headers or library files could not be found for jpeg,
      a required dependency when compiling Pillow from source.

      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html


      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pillow
  Running setup.py clean for pillow
Failed to build pillow
Installing collected packages: pillow
  Running setup.py install for pillow ... error
  error: subprocess-exited-with-error

 [ similar output from setup install step cut ]

Actual available libraries:

$ find /usr/lib /lib -name '*jpeg*'
/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/cygpixbufloader-jpeg.dll
/usr/lib/libjpeg.dll.a
/usr/lib/libopenjpeg.dll.a
/usr/lib/openjpeg-1.5
/usr/lib/pkgconfig/libjpeg.pc
/usr/lib/pkgconfig/libopenjpeg.pc
/usr/lib/qt5/plugins/imageformats/cygqjpeg.dll
/lib/gdk-pixbuf-2.0/2.10.0/loaders/cygpixbufloader-jpeg.dll
/lib/libjpeg.dll.a
/lib/libopenjpeg.dll.a
/lib/openjpeg-1.5
/lib/pkgconfig/libjpeg.pc
/lib/pkgconfig/libopenjpeg.pc
/lib/pkgconfig/libopenjpeg1.pc
/lib/qt5/plugins/imageformats/cygqjpeg.dll

$ find /usr /lib -name jpeglib.h
/usr/include/jpeglib.h

Feel free to contact me (@ mention) if you need further information.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions