python-pillow/Pillow

Unable to install Pillow on the Macbook Pro 13 M1 Silicon

HarshSonawane opened this issue Β· 80 comments

What did you do?

I tried installing a pillow with the pipenv, I have a python version 3.9.1 installed and tried to install a pillow with that but facing this issue mentioned below.

What did you expect to happen?

I wanted to use pillow with django.

What actually happened?

Pillow installation causing error continuously, the error is mentioned below.

What are your OS, Python, and Pillow versions?

  • OS: macOS Big Sur
  • Python: 3.9.1
  • Pillow: 7.2.0
Collecting Pillow==7.2.0
  Using cached Pillow-7.2.0.tar.gz (39.1 MB)
Building wheels for collected packages: Pillow
  Building wheel for Pillow (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py'"'"'; __file__='"'"'/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-wheel-rk7rd8w9
       cwd: /private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/
  Complete output (172 lines):
  running bdist_wheel
  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'
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  
  
  The headers or library files could not be found for zlib,
  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/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py", line 864, in <module>
      setup(
    File "/Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Library/Developer/CommandLineTools/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/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py", line 694, in build_extensions
      raise RequiredDependencyException(f)
  __main__.RequiredDependencyException: zlib
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py", line 918, in <module>
      raise RequiredDependencyException(msg)
  __main__.RequiredDependencyException:
  
  The headers or library files could not be found for zlib,
  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
  Running setup.py clean for Pillow
Failed to build Pillow
Installing collected packages: Pillow
    Running setup.py install for Pillow ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py'"'"'; __file__='"'"'/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/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/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-record-sbw6wf02/install-record.txt --single-version-externally-managed --compile --install-headers /Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/include/site/python3.8/Pillow
         cwd: /private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/
    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'
    warning: build_py: byte-compiling is disabled, skipping.
    
    running build_ext
    
    
    The headers or library files could not be found for zlib,
    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/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py", line 864, in <module>
        setup(
      File "/Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/install.py", line 561, in run
        self.run_command('build')
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Developer/CommandLineTools/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/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py", line 694, in build_extensions
        raise RequiredDependencyException(f)
    __main__.RequiredDependencyException: zlib
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py", line 918, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:
    
    The headers or library files could not be found for zlib,
    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/harsh/.local/share/virtualenvs/pdist-o77J8eHd/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/setup.py'"'"'; __file__='"'"'/private/var/folders/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-install-exv5oeqg/pillow_d26c2175614649e1b0d3d03ff481fca6/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/6z/3hxj8p2s6vlgfynhc4wvxfd00000gn/T/pip-record-sbw6wf02/install-record.txt --single-version-externally-managed --compile --install-headers /Users/harsh/.local/share/virtualenvs/pdist-o77J8eHd/include/site/python3.8/Pillow Check the logs for full command output.

First off, any particular reason to use Pillow 7.2.0 on not 8.x? Python 3.9 support was officially added to Pillow in 8.0.0:

https://pillow.readthedocs.io/en/stable/installation.html#python-support


I think there's still some work going on in the packaging world to support Apple silicon, and so it's attempting to install and build from source.

Please could you first try after updating pip and wheel?


It's also possible to download one of the wheels from https://pypi.org/project/Pillow/8.0.1/#files and change one of the tags in the filename, and pip install that, but I can't find the details for that now. It was something like replace x86_64 with universal2.


Or to build from source, you need to install some dependencies first:

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

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

Thank you for reaching back. I have also tried with pillow version 8.0.1 but the same issue is going on, unable to install Pillow.

I have same question
I try execute

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow

on the Macbook Pro 13 M1 Silicon have the same question
on the Macbook Air Intel Core is Successfully

@jia611 Please can you try this? (Instructions based on scipy/scipy#13102 (comment))

  1. Find your tag
$ python3 -m pip install packaging
$ python3 -c"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" |head -5

cp38-cp38-macosx_11_0_x86_64
  1. Download 8.0.1 wheel from PyPI https://pypi.org/project/Pillow/8.0.1/#files
  2. Rename downloaded file to match your tag
mv Pillow-8.0.1-cp38-cp38-macosx_10_10_x86_64.whl Pillow-8.0.1-cp38-cp38-macosx_11_0_x86_64.whl
  1. Install wheel
python3 -m pip install Pillow-8.0.1-cp38-cp38-macosx_11_0_x86_64.whl

Or scipy/scipy#13102 (comment):

Fwiw, I managed to install scipy on Big Sur (Intel Macbook) by using the compatibility mode, in which macOS will report being version 10.16 instead of 11.0:

export SYSTEM_VERSION_COMPAT=1
> sw_vers -productVersion
10.16

python3 -m pip install Pillow-8.0.1-cp38-cp38-macosx_11_0_x86_64.whl is error

ERROR: Pillow-8.0.1-cp38-cp38-macosx_11_0_x86_64.whl is not a supported wheel on this platform.

@jia611 What output do you get for this?

python3 -c"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" |head -5

@jia611 What output do you get for this?

python3 -c"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" |head -5

cp38-cp38-macosx_11_0_arm64
cp38-cp38-macosx_11_0_universal2
cp38-abi3-macosx_11_0_arm64
cp38-abi3-macosx_11_0_universal2
cp38-none-macosx_11_0_arm64

Then please try renaming it to match one of those, for example Pillow-8.0.1-cp38-cp38-macosx_11_0_universal2.whl

Perhaps an obvious answer to be had. If I download and change to Pillow-8.0.1-cp38-cp38-macosx_11_0_universal2.whl
where do I put the file to actually run sudo python3 -m pip install Pillow-8.0.1-cp38-cp38-macosx_11_0_universal2.whl?

In your current directory.
Or you could change the command to use a relative path.
Or, you could specify an absolute path, e.g. sudo python3 -m pip install /Users/geoffsharris/Downloads/Pillow-8.0.1-cp38-cp38-macosx_11_0_universal2.whl

Then please try renaming it to match one of those, for example Pillow-8.0.1-cp38-cp38-macosx_11_0_universal2.whl

thank you
Successfully installed Pillow-8.0.1

Good to hear, thanks for testing!


Now the question is what changes do we need to make for the next release to be pip installable on M1 from PyPI? Are changes needed at multibuild? I think pip+packaging (pypa/packaging#319) and wheel (pypa/wheel#390) are ready.

The installation worked on my Macbook Pro 13 M1 but when I try to use it still has problems. I am trying to run the https://github.com/tensorflow/hub/blob/master/examples/colab/object_detection.ipynb notebook.

I get the following error:
dlopen(python3.8/site-packages/PIL/_imaging.cpython-38-darwin.so, 2): no suitable image found. Did find:
tensorflow_venv/lib/python3.8/site-packages/PIL/_imaging.cpython-38-darwin.so: mach-o, but wrong architecture

@goleador how did you install Pillow?

@radarhere I have the same problem as @goleador

when i run python3 in arm arch,python3 main.py ,error log is:

    from PIL import Image, ImageDraw, ImageFont, ImageFilter
  File "/Users/tx/Work/dykt_back/venv/lib/python3.9/site-packages/PIL/Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: dlopen(/Users/tx/Work/dykt_back/venv/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so, 2): no suitable image found.  Did find:
	/Users/tx/Work/dykt_back/venv/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so: mach-o, but wrong architecture
	/Users/tx/Work/dykt_back/venv/lib/python3.9/site-packages/PIL/_imaging.cpython-39-darwin.so: mach-o, but wrong architecture

and when i run arch -x86_64 python3 main.py , the service is successful.

I installed using the directions on this thread. Basically, renaming the .whl file as described above. @radarhere

In case this is helpful to anyone, here's a wheel I put together on my M1 -
Pillow-8.0.1-cp39-cp39-macosx_11_0_arm64.whl.zip

@radarhere Tried to install your wheel on my m1.
Got :
ERROR: Pillow-8.0.1-cp39-cp39-macosx_11_0_arm64.whl is not a supported wheel on this platform. .
:(

@y4nng-dev were you using Python 3.9, or a different Python version? Could you provide the full command that you used to try and install the wheel?

@radarhere I'm using Python 3.8.2 and here is the command I used :
python3 -m pip install /Users/username/Desktop/Pillow-8.0.1-cp39-cp39-macosx_11_0_arm64.whl
Thank you

@y4nng-dev ah, yes - the wheel I attached was for Python 3.9. Here is a wheel for Python 3.8 -
Pillow-8.0.1-cp38-cp38-macosx_11_0_arm64.whl.zip

thank you

Now the question is what changes do we need to make for the next release to be pip installable on M1 from PyPI? Are changes needed at multibuild? I think pip+packaging (pypa/packaging#319) and wheel (pypa/wheel#390) are ready.

actions/runner-images#1814 is in preview, and actions/runner#805 is also pending.
I've created https://github.com/matthew-brett/multibuild/pull/379 as a start in multibuild at least.

Create a virtual environment using venv and then try to use pip to install.
It didn't work when I tried it the first time but then i used brew install libjpeg and then i tried pip then it worked.

So in your case it must have built from source, and we don't have any matching prebuilt binary wheels.

It would be nice to have binary wheels for the universal2 build of Python 3.9.1 on www.python.org, that would take away the need to build from source (which is finicky when you don't use homebrew)

Do note that support for universal2 wheels in the packaging space is very new, to the point that AFAIK the currently released version of pip won't install binary wheels with a platform tag that matches the above mentioned universal2 python. That should should resolve itself once my PR for the packaging library makes it way to a release of pip.

Yes, that would be best.

pypa/packaging#380 was merged 5 days ago, so should be vendored in the next pip 21.0, due out on 23/34 January, give or take a week (pypa/pip#9282 (comment)).

On the Pillow side, what do we actually need to do build universal2 binary wheels? Are changes needed in https://github.com/python-pillow/pillow-wheels or https://github.com/matthew-brett/multibuild?

I haven't checked the two repos you mention, but there shouldn't be many changes.

I build Pillow and jpegsrc-6b from source before filing this issue and that didn't need any changes other than specifying "-arch arm64 -arch x86_64" when building the latter. That said, I haven't tested the intel part of the wheel yet (but I don't expect problems there, given past experience with the ppc to intel transition).

The main gotcha w.r.t. building universal2 wheels at the moment is that you need to build on a macOS 11 system because the sysconfig module currently assumes that compilers on older versions of the OS cannot build arm64 binaries. That's something I intent to fix and that change will hopefully be in 3.9.2.

Okay, obviously I'm missing something here.

(testing)  dist % pip install psycopg2-2.9.dev0-cp38-cp38-macosx_10_14_arm64.whl
ERROR: psycopg2-2.9.dev0-cp38-cp38-macosx_10_14_arm64.whl is not a supported wheel on this platform.

From a comment from Pillow:

I build Pillow and jpegsrc-6b from source before filing this issue and that didn't need any changes other than specifying "-arch arm64 -arch x86_64" when building the latter. That said, I haven't tested the intel part of the wheel yet (but I don't expect problems there, given past experience with the ppc to intel transition).

So I probably need to change the target build architecture, but I don't see where to do that... ?

The problem you're seeing with pip is a buglet in pip (or rather packaging), PR 350 for packaging fixes that and will end up in a future release (AFAIK later this month).

There are more moving parts in the packaging space than I had expected beforehand, because of that I have spent too little time on the packaging ecosystem before the "universal2" changes ended up in a Python release.

Please feel free to let me know if there is anything that I can do to assist, testing, etc.

@radarhere

Trying to understand the build process here, how do you specify the architecture when running an package/wheel creation?

I just run a standard python setup.py sdist bdist_wheel?

I haven't found any documentation that builds a specific arch? So I'm a bit confused....

@bschollnick I wasn't specifying the architecture - I was just building wheels on an M1 machine. It would have been python setup.py bdist_wheel and then delocate to bundle in the libraries - python delocate/cmd/delocate_wheel.py dist/Pillow-8.2.0.dev0-cp38-cp38-macosx_11_0_arm64.whl

@bschollnick you can see over at https://github.com/python-pillow/Pillow-wheels, where we generate the Linux and macOS wheels for each release, that we're just spinning up Linux and macOS instances and building the wheel on each of them.

Hi! So, is there any workaround to make pillow work on M1? I don't have much experience building wheels. To be honest im not even sure what is a wheel but if there is a solution to this issue I would be more than happy to know about it. Many thanks!

Hi. I presume you have tried to install Pillow, but are getting an error like
'The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source.'
Pillow is complaining that you are missing zlib, one of its dependencies.

  • The most obvious approach would be to install zlib, and then try again.
  • The other approach is to try to use wheels. Wheels are just a way of packaging up Python modules for distribution, and can contain the dependencies that you are missing. You can see at https://pypi.org/project/Pillow/#files that we have many .whl files for different environments, but not yet for M1 ('arm64'). If you ran pip install Pillow then it would have searched for an environment-appropriate wheel, but failed to find one.
    • So instead, there are suggestions in this thread to take an existing wheel and changing the name to include 'universal2', so to make Python accept it as being relevant to an M1 environment.
    • I've also packaged up two wheels on my M1 machine and uploaded them in earlier comments here. If you download one and then pip install [filename.whl], that should also work for you.

To be clear, building wheels is not something that you do to help install a Python module on your computer, it's something that you do so that you can distribute the wheel and help other people install Pillow.

@liuchanganshan Why use Python 3.9.1 release candidate 1 and not the Python 3.9.1 production release?

macOS 64-bit Intel installer | Mac OS X | for macOS 10.9 and later | 74f5cc5b5783ce8fb2ca55f11f3f0699 | 29795899 | SIG
choose this version is ok.
arm64version not ok
@cclauss

Why choose macOS 64-bit Intel installer when you are on ARM64, not Intel?

m1-macbook-pro ~ % python3

Python 3.9.1 (default, Jan  8 2021, 12:11:08)
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform ; platform.processor()
'arm'

Did you try going to https://www.python.org/downloads and clicking the button Download Python 3.9.1?

Alternatively, brew install python will also install Python 3.9.1.

Here are some notes to compile Pillow from source with libjpeg support on M1 using arm64 architecture:

  1. compile libjpeg from source
curl -L -O http://ijg.org/files/jpegsrc.v9d.tar.gz
tar -xvf jpegsrc.v9d.tar.gz
cd jpeg-9d
./configure CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" LDFLAGS="-arch arm64
make
sudo make install

Note: here you need sudo to install it to /usr/local, however, you can specify where to install libJPEG by using --prefix=/dir in the ./configure command.

To check if your libJEPG is compiled with arm64 architecture

lipo -info /usr/local/lib/libjpeg.dylib

You will see something like this

Non-fat file: /usr/local/lib/libjpeg.dylib is architecture: arm64
  1. Compile Pillow for native Python 3.8 on Apple M1

Get Pillow-8.1.0 from pypi:

curl -L -O https://files.pythonhosted.org/packages/73/59/3192bb3bc554ccbd678bdb32993928cb566dccf32f65dac65ac7e89eb311/Pillow-8.1.0.tar.gz
tar -xvf Pillow-8.1.0.tar.gz
cd Pillow-8.1.0

Add the following lines after line 493 in setup.py, which tells the compiler to use -arch arm64 on Apple's M1 Arm Chip:

import platform
if platform.machine() == 'arm64':
    os.environ["ARCHFLAGS"] = "-arch arm64"

It will look like this:
Screen Shot 2021-01-22 at 12 34 24 PM

Save the setup.py. Then you can build and install it:

python3 setup.py build
python3 setup.py install --user

or

python3 setup.py build
sudo python3 setup.py install

Check the Pillow architecture:

% lipo -info _imaging.cpython-38-darwin.so 
Architectures in the fat file: _imaging.cpython-38-darwin.so are: x86_64 arm64 

You will get Pillow to work with libjpeg. You can do the same setup for OPENJPEG LIBTIFF etc.

--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version      Pillow 8.1.0
platform     darwin 3.8.2 (default, Nov  4 2020, 21:23:28)
             [Clang 12.0.0 (clang-1200.0.32.28)]
--------------------------------------------------------------------
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBIMAGEQUANT support not available
*** LIBTIFF support not available
*** FREETYPE2 support not available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
*** XCB (X protocol) support not available
--------------------------------------------------------------------
  1. Of course, you need the Xcode Command Line Tools

Sorry to bring this back up.

But I'm trying to find any documentation on adding M1 Native to Travis CI. Any docs or hints you could share? I'm trying to help out pymupdf, but I'm kind of guessing in the dark here since I've never touched Travis CI.

pymupdf/PyMuPDF#834

Nothing yet but https://docs.travis-ci.com/user/reference/osx/ is probably the place to look.

In general, GitHub Actions adopts new things more quickly.

In case this is helpful to anyone, here's a wheel I put together on my M1 -
Pillow-8.0.1-cp39-cp39-macosx_11_0_arm64.whl.zip

Thank you !!! a lot !

I've created python-pillow/pillow-wheels#185 to add arm64 wheels to pillow-wheels. Unfortunately, it first requires macOS 11 pools - see actions/runner-images#2486

For some reason I can't pip install Pillow if I don't have ffmpeg installed
Platform: M1 MacBook runs macOS 11.2
Python: version 3.9.1
Pip: version 21.0.1

@alimehasin It could be the libxcb dependency issue. Try to use flag --disable-xcb, or install libxcb using brew (with β€œarch -arm64” if native).

For some reason I can't pip install Pillow if I don't have ffmpeg installed
Platform: M1 MacBook runs macOS 11.2
Python: version 3.9.1
Pip: version 21.0.1

Thank you!

This solved my issue, brew install ffmpeg fixed the default install process for me.

if I try to sudo python3 -m pip install --upgrade Pillow

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/private/tmp/pip-install-or_9yvg6/pillow_fddc6b86afa6483bb48f047b1c40e2f9/setup.py", line 922, in
raise RequiredDependencyException(msg)
main.RequiredDependencyException:

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

@jurihahn Did you try without sudo ?

Please provide the output of this command:
uname -a ; brew --version ; python3 --version ; python3 -m pip --version

Without sudo I get the same error.

  • Darwin MacBook-Air***.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64

  • brew is not installed

  • Python 3.8.2

  • pip 21.0.1 from /Library/Python/3.8/site-packages/pip (python 3.8)

  • Xcode: latest version installed

@jurihahn it is (in theory at least) worth noting that Python 3.9.1 is the first to support Big Sur.

@jurihahn it is (in theory at least) worth noting that Python 3.9.1 is the first to support Big Sur.

Python 3.8.2 is preinstalled on macOS Big Sur
OR is installed with Xcode...

The version of Python that ships with OS X is great for learning, but it’s not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version.

https://docs.python-guide.org/starting/install3/osx/

So you should really install another Python3 besides the "system Python" if you what to do Python development. My advise would be that you follow the homebrew approach as discussed at the URL above. That will provide you with Python 3.9.1 which is M1 native as @radarhere mentions. It will also provide you with a usable pip that does not require sudo.

The version of Python that ships with OS X is great for learning, but it’s not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version.

https://docs.python-guide.org/starting/install3/osx/

So you should really install another Python3 besides the "system Python" if you what to do Python development. My advise would be that you follow the homebrew approach as discussed at the URL above. That will provide you with Python 3.9.1 which is M1 native as @radarhere mentions. It will also provide you with a usable pip that does not require sudo.

Sorry, I have MacBook on Intel too. And its same preinstalled Python version 3.8.2 and its work!

@jurihahn you can try downloading the wheel from #5093 (comment) and running python3 -m pip install Pillow-8.0.1-cp38-cp38-macosx_11_0_arm64.whl

@jurihahn you can try downloading the wheel from #5093 (comment) and running python3 -m pip install Pillow-8.0.1-cp38-cp38-macosx_11_0_arm64.whl

i don't need quick and dirty solution. I can do my job on intel MacBook, but it don't work on Arm MacBook. I report it, because same thing work on intel Mac... I think it's bug on ARM?

The difference between your two architectures would be that we provide a wheel for Python 3.8 for Intel, Pillow-8.1.0-cp39-cp39-macosx_10_10_x86_64.whl (over at PyPI). We have not yet uploaded any M1 wheels to PyPI (and there are not current plans to do so for Python 3.8, since it is not fully supported for Big Sur).

If you would like to ignore the PyPI wheels to perform a better comparison, try python3 -m pip install Pillow --no-binary :all: on both machines.

The difference between your two architectures would be that we provide a wheel for Python 3.8 for Intel, Pillow-8.1.0-cp39-cp39-macosx_10_10_x86_64.whl (over at PyPI). We have not yet uploaded any M1 wheels to PyPI (and there are not current plans to do so for Python 3.8, since it is not fully supported for Big Sur).

If you would like to ignore the PyPI wheels to perform a better comparison, try python3 -m pip install Pillow --no-binary :all: on both machines.

on Intel its already installed,
on ARM I get same error:
The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.

@jurihahn I'm saying that I don't believe this is purely an ARM bug. This is because we do not have a wheel ready to go for Python 3.8 on ARM on PyPI (the place where pip draws code from) like we do for Python 3.8 on Intel. My last comment was intended to demonstrate that to you - if you uninstall Pillow on your Intel machine and then run python3 -m pip install Pillow --no-binary :all:, I expect you will see the same bug.
However, we don't currently have current plans to support Python 3.8 on ARM, because it does not claim to support Big Sur (if you feel like it works, ok, but that's not the same as an official endorsement). So, I don't think there is anything to be done here to solve the general problem, and you don't seem concerned about your individual situation.

OK. If you don't use brew, then just install official Python 3.9 Package from https://www.python.org/downloads/
After that I can install Pillow and it's work fine!

I ran into problems when trying to configure jpeglib as described in comment on M1 ##5093 (comment) by Lixun910 because of a missing C compiler.
Adding the parameter CC="clang" referenced Mac's Clang compiler and the script continued to configure

curl -L -O http://ijg.org/files/jpegsrc.v9d.tar.gz
tar -xvf jpegsrc.v9d.tar.gz
cd jpeg-9d
./configure CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" LDFLAGS="-arch arm64
make
sudo make install

should be:
./configure CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" LDFLAGS="-arch arm64" CC="clang"

Then please try renaming it to match one of those, for example Pillow-8.0.1-cp38-cp38-macosx_11_0_universal2.whl

python3 -c"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" |head -5
cp38-cp38-macosx_11_0_arm64
cp38-cp38-macosx_11_0_universal2
cp38-cp38-macosx_10_16_universal2
cp38-cp38-macosx_10_15_universal2
cp38-cp38-macosx_10_14_universal2

I tried to rename it to the above cases, for example Pillow-8.0.1-cp38-cp38-macosx_11_0_arm64.whl , but all the results are: XXX is not a supported wheel on this platform.

@DeeEcho it is (in theory at least) worth noting that Python 3.9.1 is the first to support Big Sur..
If you would like to persist with Python 3.8 though, you can try downloading a wheel from #5093 (comment) and running pip install Pillow-8.0.1-cp38-cp38-macosx_11_0_arm64.whl

Pillow 8.1.1 has just been released, including an M1 wheel for Python 3.9.

Hey guys, is there any chance of making it work with python 2.7 on the M1 mac

Hey guys, is there any chance of making it work with python 2.7 on the M1 mac

I doubt it, due to python support.

Python v2.8 is the "earliest" version you'll find able to run in M1 native, and that's unofficial since Apple hasn't back ported the changes to the v2.8 repository (that's my understanding?). Especially the Tensorflow changes, etc.

The latest versions of Python v3 are still ironing out some of the kinks.

Please note, if you use Rosetta 2 support, PyMuPdf will work on the M1 without any special compilation, etc.

There will never be a Python 2.8 https://www.python.org/dev/peps/pep-0404

Python 2 died on 1/1/2020.

If it helps anyone on Apple Silicon

brew install libjpeg

pip install Pillow

works !

If it helps anyone on Apple Silicon

brew install libjpeg

pip install Pillow

works !

Are you sure?

yes, it worked

for me doesn't work

@Allan-Nava if you would like further assistance, please open a new issue with more detail.

simply run:
brew install libjpeg && pip3 install Pillow

fixed?

@Allan-Nava if you have a problem, please open a new issue with more detail

Can this issue be locked to force the creation of new issues?

Sure.