carsales / pyheif

Python 3.6+ interface to libheif library
Apache License 2.0
167 stars 41 forks source link

pyheif doesn't install even after brew install libffi libheif #93

Open Alex-Son23 opened 1 year ago

Alex-Son23 commented 1 year ago

I tried to instal pyheif on mac m1 and i have this issue

copying pyheif/reader.py -> build/lib.macosx-13.1-arm64-cpython-311/pyheif
      copying pyheif/writer.py -> build/lib.macosx-13.1-arm64-cpython-311/pyheif
      creating build/lib.macosx-13.1-arm64-cpython-311/pyheif/data
      copying pyheif/data/version.txt -> build/lib.macosx-13.1-arm64-cpython-311/pyheif/data
      running build_ext
      generating cffi module 'build/temp.macosx-13.1-arm64-cpython-311/_libheif_cffi.c'
      creating build/temp.macosx-13.1-arm64-cpython-311
      building '_libheif_cffi' extension
      creating build/temp.macosx-13.1-arm64-cpython-311/build
      creating build/temp.macosx-13.1-arm64-cpython-311/build/temp.macosx-13.1-arm64-cpython-311
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/include -I/usr/include -I/opt/local/include -I/Users/alexson/Documents/coding/638mm-master-mainroot/mainroot/env/include -I/Users/alexson/.pyenv/versions/3.11.3/include/python3.11 -c build/temp.macosx-13.1-arm64-cpython-311/_libheif_cffi.c -o build/temp.macosx-13.1-arm64-cpython-311/build/temp.macosx-13.1-arm64-cpython-311/_libheif_cffi.o
      build/temp.macosx-13.1-arm64-cpython-311/_libheif_cffi.c:570:15: fatal error: 'libheif/heif.h' file not found
           #include "libheif/heif.h"
                    ^~~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyheif
  Running setup.py clean for pyheif
Failed to build pyheif
ERROR: Could not build wheels for pyheif, which is required to install pyproject.toml-based projects

im already used brew install libffi libheif but in doesn't help

homm commented 1 year ago

You don't have homebrew properly installed in your system. Try this:

$ eval "$(/opt/homebrew/bin/brew shellenv)"

$ pip install git+https://github.com/carsales/pyheif.git@master#egg=pyheif
Collecting pyheif
Building wheels for collected packages: pyheif
  Building wheel for pyheif (setup.py) ... done
  Created wheel for pyheif: filename=pyheif-0.7.1-cp39-cp39-macosx_10_9_universal2.whl
Successfully built pyheif
Installing collected packages: pyheif
Successfully installed pyheif-0.7.1

$ ipython 
Python 3.9.6 (default, May  7 2023, 23:32:44) 

In [1]: import pyheif

In [2]: pyheif.__version__
Out[2]: '0.7.1'
serjsv87 commented 1 year ago

I don't know how it was possible to install brew incorrectly. I also encountered the same problem, (I have a mac M2). If the problem is frequent, maybe make a note in the readmy.

homm commented 1 year ago

If the problem is frequent, it's better to fill a ticket in brew, since it's related to any other library, not pyheif only.

Headmaster11 commented 1 year ago

Have the same problem with mac m1 and python3.11

homm commented 1 year ago

@Headmaster11 Please provide more info:

  1. Do you have HOMEBREW_PREFIX environment variable?
  2. Did you do eval "$(brew shellenv)"?
  3. Have you been aware that this is required step of brew installation?
  4. Have you reed instruction during brew installation?
  5. Have you filled a ticket in brew that you as a user had no idea about required installation step?
laurogripa commented 11 months ago

Same problem with Mac M2

I have $HOMEBREW_PREFIX set, tried eval, and installed all dependencies

evanscho commented 10 months ago

Same problem but with Mac Intel (Python 3.12), also have $HOMEBREW_PREFIX set, tried eval, and installed all dependencies. Ended up using Wand/Imagemagick.

kaxi1993 commented 8 months ago

Same problem here with mac m3 ☹️

maikebrasil commented 6 months ago

@Headmaster11 Please provide more info:

  1. Do you have HOMEBREW_PREFIX environment variable?
  2. Did you do eval "$(brew shellenv)"?
  3. Have you been aware that this is required step of brew installation?
  4. Have you reed instruction during brew installation?
  5. Have you filled a ticket in brew that you as a user had no idea about required installation step?

Hey, sorry, could you please explain what I need the "HOMEBREW_PREFIX" variable for? I think I have it, but I don't know what to do next. Also, when typing the command in 2 nothing happens (I don't know what to write into the brackets). Ty for your help <3

alew3 commented 6 months ago

yep, not working for me either .. using conda in my mac. I've set export HOMEBREW_PREFIX="/opt/homebrew" and mac m1 max

I get the following error after pip install

OSError: [Errno 66] Directory not empty: '/private/var/folders/rn/97_xyqmx1wx1bp6b9705k79m0000gn/T/pip-req-build-7zgp_3iw/.eggs/cffi-1.16.0-py3.11-macosx-11.0-arm64.egg/cffi-1.16.0.dist-info' -> '/private/var/folders/rn/97_xyqmx1wx1bp6b9705k79m0000gn/T/pip-req-build-7zgp_3iw/.eggs/cffi-1.16.0-py3.11-macosx-11.0-arm64.egg/EGG-INFO'
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed cleaning build dir for pyheif Failed to build pyheif ERROR: Could not build wheels for pyheif, which is required to install pyproject.toml-based projects

GingerNg commented 5 months ago

same problem, macos M1

odegraciajr commented 3 months ago

Same problem MacOs 14.5 M1

homm commented 3 months ago

Could you try to install from the following branch:

$ pip install git+https://github.com/uploadcare/pyheif.git@read-transformations