Pillow: pip error: "The headers or library files could not be found for jpeg"

Created on 15 Nov 2020  Â·  26Comments  Â·  Source: python-pillow/Pillow

What did you do?

pip3 install Pillow

What did you expect to happen?

installing the package properly without the hassle.

What actually happened?

 Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/72/hplzps2136jc7fy5jf8k4hs00000gn/T/pip-install-o9zi3d_u/pillow/setup.py", line 914, 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
  ----------------------------------------
  ERROR: Failed building wheel for Pillow

What are your OS, Python and Pillow versions?

  • OS: macOS Big Sur 11.0.1
  • Python: Python 3.9.0 (default, Nov 14 2020, 10:50:03) [Clang 12.0.0 (clang-1200.0.32.27)] on darwin
  • Pillow: 8.0.1

I was able to install after a short search engine research

  1. brew install libjpeg
  2. pip3 install Pillow
Installation macOS

Most helpful comment

Please don’t be rude to the developers trying to help you on a platform released within the last week.

All 26 comments

These libraries are listed in the macOS installation from source instructions linked in the error message: https://pillow.readthedocs.io/en/stable/installation.html#building-on-macos

However, this shouldn't be necessary, since Pillow does provide pre-built wheels for macOS: https://pypi.org/project/Pillow/#files (Pillow-8.0.1-cp39-cp39-macosx_10_10_x86_64.whl sounds like the right file)

Are you using one of the new Apple Silicon Macs?

No, macbook pro 2016 intel i7

It's a packaging issue, I'm not sure if the PIP or Pillow is to blame. both are responsible.

What version of pip do you have? Does it help to upgrade it?

We also recommend running python3 -m pip install ... (or whatever your python command is) instead of pip install ... to make it explicit which Python you're installing for.

If it doesn't help, please can you post the full verbose output of python3 -m pip install Pillow -v

@hugovk- Big sur clean installation, everything is the latest version. Latest python3 installed with brew.

  1. brew install python3
  2. brew link python3
  3. pip3 install Pillow
    Using pip 20.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

Thanks, what do you get when running this?

python3 -m pip install Pillow -v

Thanks, what do you get when running this?

python3 -m pip install Pillow -v
  1. brew uninstall libjpeg
  2. pip3 uninstall Pillow
  3. python3 -m pip install Pillow -v

I got 683 KB, 1986 lines output. I don't want to paste it here.

Last two lines;

.....
Successfully installed Pillow-8.0.1
Removed build tracker: '/private/var/folders/72/hplzps2136jc7fy5jf8k4hs00000gn/T/pip-req-tracker-ga908n34'

If you don't want to paste it here, please could you upload it as a zip file or to https://gist.github.com/ or pastebin?

The reason I ask is because it might help us find out why it's not installing a prebuilt binary wheel and is attempting to build from source.

There should be stuff like this, showing in my case that it found Pillow-8.0.1-cp39-cp39-macosx_10_10_x86_64.whl as a potential match, and skipped those for Linux and other Python versions:

...
  Skipping link: none of the wheel's tags match: cp38-cp38-manylinux2014_aarch64: https://files.pythonhosted.org/packages/c0/77/ca05a9365fc72252522c1b6a6cc1f579cb5791e824480c6499b789f5a988/Pillow-8.0.1-cp38-cp38-manylinux2014_aarch64.whl#sha256=7c9401e68730d6c4245b8e361d3d13e1035cbc94db86b49dc7da8bec235d0015 (from https://pypi.org/simple/pillow/) (requires-python:>=3.6)
  Skipping link: none of the wheel's tags match: cp38-cp38-win32: https://files.pythonhosted.org/packages/f4/8c/45f28efc015ec0040bb6cbde9e763140818388938dd0d2f9e6304322f11f/Pillow-8.0.1-cp38-cp38-win32.whl#sha256=6c1aca8231625115104a06e4389fcd9ec88f0c9befbabd80dc206c35561be271 (from https://pypi.org/simple/pillow/) (requires-python:>=3.6)
  Skipping link: none of the wheel's tags match: cp38-cp38-win_amd64: https://files.pythonhosted.org/packages/d2/2c/9ac71068585b3d528349be6617ed963068bfcba3da21018cdb0d2b19f07c/Pillow-8.0.1-cp38-cp38-win_amd64.whl#sha256=cc9ec588c6ef3a1325fa032ec14d97b7309db493782ea8c304666fb10c3bd9a7 (from https://pypi.org/simple/pillow/) (requires-python:>=3.6)
  Found link https://files.pythonhosted.org/packages/b2/a2/5a1924e8af7e197c277127be7682a2491d7c1a144b008dd40830f6567bfb/Pillow-8.0.1-cp39-cp39-macosx_10_10_x86_64.whl#sha256=eb472586374dc66b31e36e14720747595c2b265ae962987261f044e5cce644b5 (from https://pypi.org/simple/pillow/) (requires-python:>=3.6), version: 8.0.1
  Skipping link: none of the wheel's tags match: cp39-cp39-manylinux1_i686: https://files.pythonhosted.org/packages/c5/a1/c922dedd3c075431395a1672413f891a5921988a7bab2c1088ff57a5897f/Pillow-8.0.1-cp39-cp39-manylinux1_i686.whl#sha256=0eeeae397e5a79dc088d8297a4c2c6f901f8fb30db47795113a4a605d0f1e5ce (from https://pypi.org/simple/pillow/) (requires-python:>=3.6)
...

But wait!

Successfully installed Pillow-8.0.1

Looks like it's working now?

PIP installs package but Image module fails without libjpeg

....   
 from PIL import Image
  File "/usr/local/lib/python3.9/site-packages/PIL/Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: dlopen(/usr/local/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so, 2): Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.9.dylib
  Referenced from: /usr/local/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so
  Reason: image not found

I don't even need the jpeg format. . It is a pity that there is no PIL alternative for writing animated GIFs.

Starting with Pillow 3.0.0, libjpeg is required by default, but may be disabled with the --disable-jpeg flag.

https://pillow.readthedocs.io/en/stable/installation.html#building-from-source

Starting with Pillow 3.0.0, libjpeg is required by default, but may be disabled with the --disable-jpeg flag.

https://pillow.readthedocs.io/en/stable/installation.html#building-from-source

libjpeg is not the default in the operating system, but the default for Pillow. I hate ad hominem developers.

Please don’t be rude to the developers trying to help you on a platform released within the last week.

Also, this is very difficult to write. because I just want to write gif and png. I need to reduce the package size.

python3 -m pip install --upgrade Pillow --global-option="build_ext" --global-option="--disable-jpeg" --global-option="--disable-zlib" --global-option="--disable-tiff" --global-option="--disable-freetype" --global-option="--disable-lcms" --global-option="--disable-webp" --global-option="--disable-webpmux" --global-option="--disable-jpeg2000" --global-option="--disable-imagequant" --global-option="--disable-xcb"

Having just upgraded to Big Sur and trying to install Pillow into Python 3.6 using pip, I also see that the binary wheels are not being recognised.

Looking around, this seems to be a wider problem than just Pillow.

https://github.com/pypa/pip/issues/9138#issuecomment-727659873

The cause is clear, pip is not seeing a wheel built for MacOS 10.x as valid for MacOS 11.

https://github.com/pypa/packaging/pull/319 is a potential solution.

pypa/packaging#319 has now been merged. Testing again, I find that pip now installs using the binary.

@hazarek if you are interested in trying again, I think you might also find that the binary wheel is detected, meaning that it should now successfully install on your machine?

i will try tonight

@radarhere

➜  ~ pip3 install Pillow
Collecting Pillow
  Using cached Pillow-8.0.1-cp39-cp39-macosx_10_10_x86_64.whl (2.2 MB)
Installing collected packages: Pillow
Successfully installed Pillow-8.0.1

Doesn't appear to be detected on the M1 Silicone Macs...?

(downloader) benjamin@Nerv shellscripts % pip install pillow
Collecting pillow
  Using cached https://files.pythonhosted.org/packages/2b/06/93bf1626ef36815010e971a5ce90f49919d84ab5d2fa310329f843a74bc1/Pillow-8.0.1.tar.gz
Installing collected packages: pillow
  Running setup.py install for pillow ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/benjamin/venvs/downloader/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py'"'"'; __file__='"'"'/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-record-oat96_vk/install-record.txt --single-version-externally-managed --compile --install-headers /Users/benjamin/venvs/downloader/include/site/python3.8/pillow
         cwd: /private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/
    Complete output (174 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14.6-arm64-3.8
    creating build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/MpoImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageMode.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PngImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/XbmImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PcxImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/SunImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/SpiderImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/TarIO.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/FitsStubImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/MpegImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/BdfFontFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/GribStubImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageStat.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PixarImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/GimpPaletteFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageColor.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ContainerIO.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/MspImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/MicImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/_version.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImtImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/GifImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PalmImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageQt.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageMath.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PaletteFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/FontFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PdfParser.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ExifTags.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageCms.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/FpxImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageChops.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/BufrStubImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PSDraw.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PcdImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageFilter.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageDraw2.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImagePath.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/DcxImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/JpegPresets.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/Hdf5StubImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/features.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageDraw.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/GimpGradientFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageWin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/IcoImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/_tkinter_finder.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/EpsImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/TgaImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageMorph.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/Jpeg2KImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/WalImageFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PcfFontFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/BlpImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageTk.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/GbrImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageOps.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PdfImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageShow.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageEnhance.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/WmfImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageGrab.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/WebPImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/FliImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/TiffTags.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/CurImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/_util.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/GdImageFile.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/TiffImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/IptcImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImagePalette.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/BmpImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageTransform.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/IcnsImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/McIdasImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/XpmImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/DdsImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageSequence.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PyAccess.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/_binary.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/Image.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/__main__.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/XVThumbImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/SgiImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PsdImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/JpegImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/ImageFont.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/PpmImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    copying src/PIL/FtexImagePlugin.py -> build/lib.macosx-10.14.6-arm64-3.8/PIL
    running egg_info
    writing src/Pillow.egg-info/PKG-INFO
    writing dependency_links to src/Pillow.egg-info/dependency_links.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 previously-included files found matching '.appveyor.yml'
    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 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'
    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 "/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py", line 861, in <module>
        setup(
      File "/Users/benjamin/venvs/downloader/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/benjamin/venvs/downloader/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/install.py", line 561, in run
        self.run_command('build')
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/benjamin/venvs/downloader/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 84, in run
        _build_ext.run(self)
      File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py", line 698, 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 1, in <module>
      File "/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py", line 914, 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


    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/benjamin/venvs/downloader/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py'"'"'; __file__='"'"'/private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-install-jycwtrjx/pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/6g/0vldjqgd5d55rdv163phqh6r0000gn/T/pip-record-oat96_vk/install-record.txt --single-version-externally-managed --compile --install-headers /Users/benjamin/venvs/downloader/include/site/python3.8/pillow Check the logs for full command output.

Any solution for error above for M1 Mac installation?

@bschollnick You probably don't want to compile, you probably want there to be a wheel… @eashishkalra Traceback?

@python-pillow/pillow-team Maybe we just need to leave one of these "headers or library files" issues opened permanently … and then paste in links to other more relevant issues … e.g. "wheels for M1 macs" ?

@eashishkalra

  1. brew install libjpeg
  2. pip3 install Pillow

python-pillow/pillow-team Maybe we just need to leave one of these "headers or library files" issues opened permanently … and then paste in links to other more relevant issues … e.g. "wheels for M1 macs" ?

I think that was one of the inspirations for the new Discussions feature, as in most cases installation is not really an "issue" in Pillow (although it is in some cases).

@python-pillow/pillow-team Maybe we just need to leave one of these "headers or library files" issues opened permanently … and then paste in links to other more relevant issues … e.g. "wheels for M1 macs" ?

We could try that, and maybe lock and pin it, but I think people often find other issues via search. The M1 issue is currently 3rd in the issue list, so not that hard to find if browsing, not searching. I'll pin that too. And we probably will need some M1 changes for the next release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boskicthebrain picture boskicthebrain  Â·  4Comments

HansHirse picture HansHirse  Â·  3Comments

nomarek picture nomarek  Â·  3Comments

SysoevDV picture SysoevDV  Â·  3Comments

damianmoore picture damianmoore  Â·  4Comments