bigcat88 / pillow_heif

Python library for working with HEIF images and plugin for Pillow.
BSD 3-Clause "New" or "Revised" License
214 stars 17 forks source link

Issue installing on Arm based Mac OS #10

Closed bajabob closed 2 years ago

bajabob commented 2 years ago

Using Python 3.8, Mac OS 12.0.1, M1 Max

Following the instructions,

Step One Output

➜  appsnacks git:(main) ✗ brew install libffi libheif
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
atmos                 fisher                luau                  rizin                 tfmigrate
btop                  git-branchless        mt32emu               rustfmt               tfproviderlint
cava                  java-service-wrapper  php@8.0               smug                  urlwatch
cgif                  kubeval               pip-tools             swiftplantuml
fastfec               libsoup@2             regula                symengine
==> Updated Formulae
Updated 1026 formulae.
==> Renamed Formulae
rt-audio -> rtaudio
==> Deleted Formulae
amap                                                    soundpipe

Warning: libffi 3.4.2 is already installed and up-to-date.
To reinstall 3.4.2, run:
  brew reinstall libffi
Warning: libheif 1.12.0_1 is already installed and up-to-date.
To reinstall 1.12.0_1, run:
  brew reinstall libheif

Step Two Output

➜  appsnacks git:(main) ✗ pip3 install --upgrade pillow_heif
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pillow_heif in /Users/bob/Library/Python/3.8/lib/python/site-packages (0.1.3)
Collecting pillow_heif
  Using cached pillow_heif-0.1.4.tar.gz (19.5 MB)
  WARNING: Value for prefixed-purelib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-build-env-w5pe9h5e/normal/lib/python3.8/site-packages
  sysconfig: /Library/Python/3.8/site-packages
  WARNING: Value for prefixed-platlib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-build-env-w5pe9h5e/normal/lib/python3.8/site-packages
  sysconfig: /Library/Python/3.8/site-packages
  WARNING: Additional context:
  user = False
  home = None
  root = None
  prefix = '/private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-build-env-w5pe9h5e/normal'
  WARNING: Value for prefixed-purelib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-build-env-w5pe9h5e/overlay/lib/python3.8/site-packages
  sysconfig: /Library/Python/3.8/site-packages
  WARNING: Value for prefixed-platlib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-build-env-w5pe9h5e/overlay/lib/python3.8/site-packages
  sysconfig: /Library/Python/3.8/site-packages
  WARNING: Additional context:
  user = False
  home = None
  root = None
  prefix = '/private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-build-env-w5pe9h5e/overlay'
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: Pillow in /Users/bob/Library/Python/3.8/lib/python/site-packages (from pillow_heif) (8.4.0)
Requirement already satisfied: cffi>=1.0.0 in /Users/bob/Library/Python/3.8/lib/python/site-packages (from pillow_heif) (1.15.0)
Requirement already satisfied: pycparser in /Users/bob/Library/Python/3.8/lib/python/site-packages (from cffi>=1.0.0->pillow_heif) (2.20)
Building wheels for collected packages: pillow-heif
  Building wheel for pillow-heif (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Users/bob/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/tmpojyt2acz
       cwd: /private/var/folders/jp/t829x8110sl6tz4blxxd9_w00000gn/T/pip-install-bbaa9mji/pillow-heif_3ee714bb207345d0b75a1aa30b9915f3
  Complete output (24 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-arm64-3.8
  creating build/lib.macosx-10.14-arm64-3.8/pillow_heif
  copying pillow_heif/error.py -> build/lib.macosx-10.14-arm64-3.8/pillow_heif
  copying pillow_heif/as_opener.py -> build/lib.macosx-10.14-arm64-3.8/pillow_heif
  copying pillow_heif/constants.py -> build/lib.macosx-10.14-arm64-3.8/pillow_heif
  copying pillow_heif/__init__.py -> build/lib.macosx-10.14-arm64-3.8/pillow_heif
  copying pillow_heif/reader.py -> build/lib.macosx-10.14-arm64-3.8/pillow_heif
  copying pillow_heif/writer.py -> build/lib.macosx-10.14-arm64-3.8/pillow_heif
  running build_ext
  generating cffi module 'build/temp.macosx-10.14-arm64-3.8/pillow_heif._libheif.c'
  creating build/temp.macosx-10.14-arm64-3.8
  building 'pillow_heif._libheif' extension
  creating build/temp.macosx-10.14-arm64-3.8/build
  creating build/temp.macosx-10.14-arm64-3.8/build/temp.macosx-10.14-arm64-3.8
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/usr/local/include -I/usr/include -I/opt/local/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c build/temp.macosx-10.14-arm64-3.8/pillow_heif._libheif.c -o build/temp.macosx-10.14-arm64-3.8/build/temp.macosx-10.14-arm64-3.8/pillow_heif._libheif.o
  build/temp.macosx-10.14-arm64-3.8/pillow_heif._libheif.c:570:15: fatal error: 'libheif/heif.h' file not found
       #include "libheif/heif.h"
                ^~~~~~~~~~~~~~~~
  1 error generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pillow-heif
Failed to build pillow-heif
ERROR: Could not build wheels for pillow-heif, which is required to install pyproject.toml-based projects
bigcat88 commented 2 years ago

@bajabob thanks for reporting this, tomorrow will look at it.

bigcat88 commented 2 years ago

@bajabob I will order mac mini M1 probably at Monday, and till end of next week will fix this. Without access to M1 it's hard to tell what reason of not finding libheif/heif.h which are included in source distribution...

bigcat88 commented 2 years ago

@bajabob it doesn't compile form first time, but second time run compile and it is does... weird, will look later at this. after first failed pip3 install git+https://github.com/bigcat88/pillow_heif.git i run again pip3 install git+https://github.com/bigcat88/pillow_heif.git and all was successful.

can you check this?

P.S.: on next week i will try figure out home to make binary wheels for M1 and post them if it is possible using Monterey OS.

bigcat88 commented 2 years ago

@bajabob fixed. it was really a bug, sorry. from this release binary binaries for M1 will be present and they even might work. 0.1.5 published.

bajabob commented 2 years ago

@bajabob fixed. it was really a bug, sorry. from this release binary binaries for M1 will be present and they even might work. 0.1.5 published.

Thank you so much for following up. This appears to be the only HEIF library with active support. Appreciate you.

bigcat88 commented 2 years ago

@bajabob Published a new release, there was a fix for M1 builds, previously build them on Monterey 12.2, now I build them on VM with Monterey 12.0.1 and it should work in all Monterey releases. If you get any bugs(especially with M1 or Windows builds) please report them, i will fix.