carsales / pyheif Goto Github PK
View Code? Open in Web Editor NEWPython 3.6+ interface to libheif library
License: Apache License 2.0
Python 3.6+ interface to libheif library
License: Apache License 2.0
I'm trying to use pyheif in Windows. For that, I've tried following this solution, provided Yienschwen.
It worked so far as I was able to run pip install pyheif without any problem.
However, now, I'm trying to import pyheif, and I get the following error:
I can't find that file anywhere on the internet...
Gidday!
A couple of points:
pip
, and upgrading pip
from PyPi does not account for their patches. See for instance this from the Python guy at Fedora. Instead I suggest recommending a minimum pip version needed to install pyheifpip
directly, to my best knowledge python3 -m pip
or python -m pip
is now recommended as best practice by the pip developers. I can't recall where I read that however. Something like this: python3 -m pip install --user pyheif
. AFAIK newer versions of pip don't need --user
but older versions do.On Ubuntu 18.04 with Python 3.6 I observed that the package tries to install from source, even though a wheel is available, and it fails on missing headers.
building '_libheif_cffi' extension
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -f
PIC -I/usr/local/include -I/usr/include -I/usr/include/python3.6m -I/home/bzamecnik/.virtualenvs/rossum3/include/python3.6m -c build/temp.linux-x86_64-3.6/_l
ibheif_cffi.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_libheif_cffi.o
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_unknown_brand’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:836:12: error: ‘heif_unknown_brand’ undeclared (first use in this function)
int n = (heif_unknown_brand) <= 0;
^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:836:12: note: each undeclared identifier is reported only once for each function it appears in
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_heic’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:843:12: error: ‘heif_heic’ undeclared (first use in this function); did you mean ‘heif_writer’?
int n = (heif_heic) <= 0;
^~~~~~~~~
heif_writer
I installed the system dependencies:
sudo apt install libffi-dev libheif-dev libde265-dev
Actually the README.md is not incorrect for Ubuntu 18.04. There's no package libffi, just libffi-dev or libffi6. Both of them are installed.
It looks like the libheif-dev was too old on the system for the python package source code.
We can install from wheel anyway. The problem why wheel was not used was matching the tags (manylinux), in particular pip was missing the cp36-cp36m-manylinux2014_x86_64
(had only cp36-cp36m-manylinux2010_x86_64
). This was due to an older version of pip (19.2), rather than 19.3.
pip install -U pip
pip install pyheif
Then it works!
Good project, works fine and great. Thanks you for your work.
We install it without admin permissions, and on Ubuntu all is fine, it install from binaries, but on Debian 10 with pip 18.1 it ask for package with manylinux1 tag, and there is no one.
Is it possible to add that tag to support installation with using binaries, without building it from sources?
Thanks you anyway, we appreciate you for your work!
Were there any dependency changes? I am getting the below error. Everything worked fine on 0.4
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/include -I/usr/include -I/Users/edwin/code/Cove/venv/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c -o build/temp.macosx-10.9-x86_64-3.6/build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.o
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:884:12: error: use of undeclared identifier 'heif_avif'
int n = (heif_avif) <= 0;
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:885:30: error: use of undeclared identifier 'heif_avif'
*o = (unsigned long long)((heif_avif) | 0); /* check that heif_avif is an integer */
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:891:12: error: use of undeclared identifier 'heif_avis'; did you mean 'heif_heis'?
int n = (heif_avis) <= 0;
^~~~~~~~~
heif_heis
/usr/local/include/libheif/heif.h:295:3: note: 'heif_heis' declared here
heif_heis, // scalable
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:892:30: error: use of undeclared identifier 'heif_avis'; did you mean 'heif_heis'?
*o = (unsigned long long)((heif_avis) | 0); /* check that heif_avis is an integer */
^~~~~~~~~
heif_heis
/usr/local/include/libheif/heif.h:295:3: note: 'heif_heis' declared here
heif_heis, // scalable
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:1129:12: error: use of undeclared identifier 'heif_compression_AV1'; did you mean 'heif_compression_AVC'?
int n = (heif_compression_AV1) <= 0;
^~~~~~~~~~~~~~~~~~~~
heif_compression_AVC
/usr/local/include/libheif/heif.h:713:3: note: 'heif_compression_AVC' declared here
heif_compression_AVC = 2,
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:1130:30: error: use of undeclared identifier 'heif_compression_AV1'; did you mean 'heif_compression_AVC'?
*o = (unsigned long long)((heif_compression_AV1) | 0); /* check that heif_compression_AV1 is an integer */
^~~~~~~~~~~~~~~~~~~~
heif_compression_AVC
/usr/local/include/libheif/heif.h:713:3: note: 'heif_compression_AVC' declared here
heif_compression_AVC = 2,
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:1577:12: error: use of undeclared identifier 'heif_suberror_No_av1C_box'; did you mean 'heif_suberror_No_hvcC_box'?
int n = (heif_suberror_No_av1C_box) <= 0;
^~~~~~~~~~~~~~~~~~~~~~~~~
heif_suberror_No_hvcC_box
/usr/local/include/libheif/heif.h:140:3: note: 'heif_suberror_No_hvcC_box' declared here
heif_suberror_No_hvcC_box = 106,
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:1578:30: error: use of undeclared identifier 'heif_suberror_No_av1C_box'; did you mean 'heif_suberror_No_hvcC_box'?
*o = (unsigned long long)((heif_suberror_No_av1C_box) | 0); /* check that heif_suberror_No_av1C_box is an integer */
^~~~~~~~~~~~~~~~~~~~~~~~~
heif_suberror_No_hvcC_box
/usr/local/include/libheif/heif.h:140:3: note: 'heif_suberror_No_hvcC_box' declared here
heif_suberror_No_hvcC_box = 106,
^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:5133:14: error: no member named 'convert_hdr_to_8bit' in 'struct heif_decoding_options'
(void)((p->convert_hdr_to_8bit) | 0); /* check that 'struct heif_decoding_options.convert_hdr_to_8bit' is an integer */
~ ^
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:5449:28: error: no member named 'convert_hdr_to_8bit' in 'heif_decoding_options'
{ "convert_hdr_to_8bit", offsetof(struct heif_decoding_options, convert_hdr_to_8bit),
^ ~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include/stddef.h:120:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
^ ~
build/temp.macosx-10.9-x86_64-3.6/_libheif_cffi.c:5450:72: error: no member named 'convert_hdr_to_8bit' in 'struct heif_decoding_options'
sizeof(((struct heif_decoding_options *)0)->convert_hdr_to_8bit),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
11 errors generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
As HEIF supports burst mode, it's common for HEIF files to have multiple frames in the same file.
Reading a file with pyheif.read_heif()
only reads the first frame.
Support needs to be added for reading subsequent frames.
hello, trying to do some image processing on my images. Unfortunately iPhones switched to using heic files sometime recently and now all of my newer images are heic. I am already using the PILLOW library so i was happy when i saw this library that adds heic use to pillow:
https://pypi.org/project/pyheif-pillow-opener/
However when i install it using pip:
pip3 install pyheif-pillow-opener i get an error. After running through the dependencies of this i got to this library, pyheif, and tried running:
pip3 install pyheif only to get this:
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c build/temp.macosx-10.9-x86_64-3.9/_libheif_cffi.c -o build/temp.macosx-10.9-x86_64-3.9/build/temp.macosx-10.9-x86_64-3.9/_libheif_cffi.o
build/temp.macosx-10.9-x86_64-3.9/_libheif_cffi.c:570:15: fatal error: 'libheif/heif.h' file not found
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
is there any way to fix this issue? I can't seem to open any heic files with python until i can resolve this. Thank you!
Hi,
I'm trying to install pyheif
over pip
on a docker container running Ubuntu 18.04
. The docker is hosted on M1 Mac which means the CPU architecture is aarch64/armv8
which apparently isn't compatible with the armv7l
or at least pip
won't let me use that wheel.
This is effectively Ubuntu 18.04 on armv8. pip
probably attempts to build a wheel for my platform but this fails with the following error, indicating incompatible libraries:
I also tried your instructions to build the package from the source but it produced the same error. In the end, I managed to get the thing installed by running your dockerfile steps that manually build the correct versions of the dependencies.
Could we have a wheel for aarch64/armv8
?
On https://pypi.org/project/pyheif/ it incorrectly says yum|apt install libheif-dev libde264-dev x265-dev
To fix:
apt install libheif-dev libde265-dev libx265-dev
yum|dnf install libheif-devel libde265-devel x265-devel
Edited: corrected last apt package
From my little investigation, I found that since libheif 1.10.0 the heif_image_handle_get_raw_color_profile_size
always returns 0 for non-rICC color profile images.
I suspect this leads to the following error when opening a nclx image:
HeifError Traceback (most recent call last)
<ipython-input-15-49240deda0a0> in <module>
----> 1 pyheif.read("./0_1 (1).heic")
~/.local/lib/python3.9/site-packages/pyheif/reader.py in read(fp, apply_transformations, convert_hdr_to_8bit)
35 def read(fp, *, apply_transformations=True, convert_hdr_to_8bit=True):
36 d = _get_bytes(fp)
---> 37 result = _read_heif_bytes(d, apply_transformations, convert_hdr_to_8bit)
38 return result
39
~/.local/lib/python3.9/site-packages/pyheif/reader.py in _read_heif_bytes(d, apply_transformations, convert_hdr_to_8bit)
70 ctx = _libheif_cffi.lib.heif_context_alloc()
71 try:
---> 72 result = _read_heif_context(ctx, d, apply_transformations, convert_hdr_to_8bit)
73 finally:
74 _libheif_cffi.lib.heif_context_free(ctx)
~/.local/lib/python3.9/site-packages/pyheif/reader.py in _read_heif_context(ctx, d, apply_transformations, convert_hdr_to_8bit)
98
99 try:
--> 100 result = _read_heif_handle(handle, apply_transformations, convert_hdr_to_8bit)
101 finally:
102 _libheif_cffi.lib.heif_image_handle_release(handle)
~/.local/lib/python3.9/site-packages/pyheif/reader.py in _read_heif_handle(handle, apply_transformations, convert_hdr_to_8bit)
146
147 metadata = _read_metadata(handle)
--> 148 color_profile = _read_color_profile(handle)
149
150 heif_file = HeifFile(
~/.local/lib/python3.9/site-packages/pyheif/reader.py in _read_color_profile(handle)
220 error = _libheif_cffi.lib.heif_image_handle_get_raw_color_profile(handle, p_data)
221 if error.code != 0:
--> 222 raise _error.HeifError(
223 code=error.code,
224 subcode=error.subcode,
HeifError: Code: 10, Subcode: 0, Message: "Color profile does not exist: Unspecified"
Hi! I'm having a little trouble installing pyheif
in a virtual enviroment, using Python 3.6.9
and Ubuntu 18.04
.
Here are the error messages I'm getting:
(venv) ➜ tmp_ds python --version
Python 3.6.9
(venv) ➜ tmp_ds sudo apt-get install libheif-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libheif-dev is already the newest version (1.1.0-2).
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
(venv) ➜ tmp_ds pip install pyheif
Collecting pyheif
Using cached https://files.pythonhosted.org/packages/f1/13/30f03823d91fbcdb0581c3fd36e7a087f4618ba9b8533c0c6a0564700c0a/pyheif-0.4.tar.gz
Requirement already satisfied: cffi>=1.0.0 in ./venv/lib/python3.6/site-packages (from pyheif)
Requirement already satisfied: pycparser in ./venv/lib/python3.6/site-packages (from cffi>=1.0.0->pyheif)
Building wheels for collected packages: pyheif
Running setup.py bdist_wheel for pyheif ... error
Complete output from command /home/williambecher/Downloads/tmp_ds/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-giwzilua/pyheif/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 /tmp/tmpn7z46idbpip-wheel- --python-tag cp36:
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pyheif
copying pyheif/writer.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/constants.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/error.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/__init__.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/reader.py -> build/lib.linux-x86_64-3.6/pyheif
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.6/_libheif_cffi.c'
creating build/temp.linux-x86_64-3.6
building '_libheif_cffi' extension
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/home/williambecher/Downloads/tmp_ds/venv/include -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_libheif_cffi.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_libheif_cffi.o
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1109:37: error: return type is an incomplete type
static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_color_profile_type’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1111:10: warning: implicit declaration of function ‘heif_image_handle_get_color_profile_type’; did you mean ‘_cffi_d_heif_image_handle_get_color_profile_type’? [-Wimplicit-function-declaration]
return heif_image_handle_get_color_profile_type(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_color_profile_type
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1111:10: warning: ‘return’ with a value, in function returning void
return heif_image_handle_get_color_profile_type(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1109:37: note: declared here
static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_f_heif_image_handle_get_color_profile_type’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1120:32: error: storage size of ‘result’ isn’t known
enum heif_color_profile_type result;
^~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1120:32: warning: unused variable ‘result’ [-Wunused-variable]
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_raw_color_profile’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1468:10: warning: implicit declaration of function ‘heif_image_handle_get_raw_color_profile’; did you mean ‘_cffi_d_heif_image_handle_get_raw_color_profile’? [-Wimplicit-function-declaration]
return heif_image_handle_get_raw_color_profile(x0, x1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_raw_color_profile
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1468:10: error: incompatible types when returning type ‘int’ but ‘struct heif_error’ was expected
return heif_image_handle_get_raw_color_profile(x0, x1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_f_heif_image_handle_get_raw_color_profile’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1506:12: error: incompatible types when assigning to type ‘struct heif_error’ from type ‘int’
{ result = heif_image_handle_get_raw_color_profile(x0, x1); }
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_raw_color_profile_size’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1524:10: warning: implicit declaration of function ‘heif_image_handle_get_raw_color_profile_size’; did you mean ‘_cffi_d_heif_image_handle_get_raw_color_profile_size’? [-Wimplicit-function-declaration]
return heif_image_handle_get_raw_color_profile_size(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_raw_color_profile_size
build/temp.linux-x86_64-3.6/_libheif_cffi.c: At top level:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:512:7: note: in definition of macro ‘_cffi_prim_int’
((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:512:22: note: in definition of macro ‘_cffi_prim_int’
((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:513:7: note: in definition of macro ‘_cffi_prim_int’
(size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:513:22: note: in definition of macro ‘_cffi_prim_int’
(size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:514:7: note: in definition of macro ‘_cffi_prim_int’
(size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:514:22: note: in definition of macro ‘_cffi_prim_int’
(size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:515:7: note: in definition of macro ‘_cffi_prim_int’
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:515:22: note: in definition of macro ‘_cffi_prim_int’
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_raw_color_profile’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1469:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyheif
Running setup.py clean for pyheif
Failed to build pyheif
Installing collected packages: pyheif
Running setup.py install for pyheif ... error
Complete output from command /home/williambecher/Downloads/tmp_ds/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-giwzilua/pyheif/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vs8dv0rt-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/williambecher/Downloads/tmp_ds/venv/include/site/python3.6/pyheif:
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pyheif
copying pyheif/writer.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/constants.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/error.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/__init__.py -> build/lib.linux-x86_64-3.6/pyheif
copying pyheif/reader.py -> build/lib.linux-x86_64-3.6/pyheif
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.6/_libheif_cffi.c'
creating build/temp.linux-x86_64-3.6
building '_libheif_cffi' extension
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/home/williambecher/Downloads/tmp_ds/venv/include -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_libheif_cffi.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_libheif_cffi.o
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1109:37: error: return type is an incomplete type
static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_color_profile_type’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1111:10: warning: implicit declaration of function ‘heif_image_handle_get_color_profile_type’; did you mean ‘_cffi_d_heif_image_handle_get_color_profile_type’? [-Wimplicit-function-declaration]
return heif_image_handle_get_color_profile_type(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_color_profile_type
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1111:10: warning: ‘return’ with a value, in function returning void
return heif_image_handle_get_color_profile_type(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1109:37: note: declared here
static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_f_heif_image_handle_get_color_profile_type’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1120:32: error: storage size of ‘result’ isn’t known
enum heif_color_profile_type result;
^~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1120:32: warning: unused variable ‘result’ [-Wunused-variable]
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_raw_color_profile’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1468:10: warning: implicit declaration of function ‘heif_image_handle_get_raw_color_profile’; did you mean ‘_cffi_d_heif_image_handle_get_raw_color_profile’? [-Wimplicit-function-declaration]
return heif_image_handle_get_raw_color_profile(x0, x1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_raw_color_profile
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1468:10: error: incompatible types when returning type ‘int’ but ‘struct heif_error’ was expected
return heif_image_handle_get_raw_color_profile(x0, x1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_f_heif_image_handle_get_raw_color_profile’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1506:12: error: incompatible types when assigning to type ‘struct heif_error’ from type ‘int’
{ result = heif_image_handle_get_raw_color_profile(x0, x1); }
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_raw_color_profile_size’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1524:10: warning: implicit declaration of function ‘heif_image_handle_get_raw_color_profile_size’; did you mean ‘_cffi_d_heif_image_handle_get_raw_color_profile_size’? [-Wimplicit-function-declaration]
return heif_image_handle_get_raw_color_profile_size(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_raw_color_profile_size
build/temp.linux-x86_64-3.6/_libheif_cffi.c: At top level:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:512:7: note: in definition of macro ‘_cffi_prim_int’
((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:512:22: note: in definition of macro ‘_cffi_prim_int’
((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:513:7: note: in definition of macro ‘_cffi_prim_int’
(size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:513:22: note: in definition of macro ‘_cffi_prim_int’
(size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:514:7: note: in definition of macro ‘_cffi_prim_int’
(size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:514:22: note: in definition of macro ‘_cffi_prim_int’
(size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:58: error: invalid application of ‘sizeof’ to incomplete type ‘enum heif_color_profile_type’
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:515:7: note: in definition of macro ‘_cffi_prim_int’
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1808:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^
build/temp.linux-x86_64-3.6/_libheif_cffi.c:515:22: note: in definition of macro ‘_cffi_prim_int’
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
^~~~
build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_get_raw_color_profile’:
build/temp.linux-x86_64-3.6/_libheif_cffi.c:1469:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/williambecher/Downloads/tmp_ds/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-giwzilua/pyheif/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vs8dv0rt-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/williambecher/Downloads/tmp_ds/venv/include/site/python3.6/pyheif" failed with error code 1 in /tmp/pip-build-giwzilua/pyheif/
Hello, could you please check this file, THX.
tree-with-transparency.heif.zip
Hello, after MANY hours researching and debugging i've concluded that the support for windows OS is either bugged or non existing. but no worries: LUCKILY i've noticied it so you can fix that! :) let me know when you sort it out thank you my friend!
There are some changes in master
made since the latest 0.6.0 release. Some of them already used in heif-image-plugin. Will be cool to see a new release.
Hi, I've installed and run this on ubuntu fine but having problems on Rasberry Pi. The dependencies seem to be there but the tokens in your heif.h file don't seem to be picked up. Hopefully this is something simple I'm missing out.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyheif
Using cached https://files.pythonhosted.org/packages/a0/b5/74e08a65b3775153f72b2bf75adf9ca48f41db207e0d21dd7c8876e413cb/pyheif-0.5.1.tar.gz
Requirement already satisfied: cffi>=1.0.0 in ./.local/lib/python3.7/site-packages (from pyheif) (1.14.2)
Requirement already satisfied: pycparser in ./.local/lib/python3.7/site-packages (from cffi>=1.0.0->pyheif) (2.20)
Building wheels for collected packages: pyheif
Running setup.py bdist_wheel for pyheif: started
Running setup.py bdist_wheel for pyheif: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-gtwqgz5p/pyheif/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 /tmp/pip-wheel-gpqdg37p --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/pyheif
copying pyheif/error.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/constants.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/__init__.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/reader.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/writer.py -> build/lib.linux-armv7l-3.7/pyheif
creating build/lib.linux-armv7l-3.7/pyheif/data
copying pyheif/data/version.txt -> build/lib.linux-armv7l-3.7/pyheif/data
running build_ext
generating cffi module 'build/temp.linux-armv7l-3.7/_libheif_cffi.c'
creating build/temp.linux-armv7l-3.7
building '_libheif_cffi' extension
creating build/temp.linux-armv7l-3.7/build
creating build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.7m -c build/temp.linux-armv7l-3.7/_libheif_cffi.c -o build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7/_libheif_cffi.o
build/temp.linux-armv7l-3.7/_libheif_cffi.c: In function ‘_cffi_const_heif_unknown_brand’:
build/temp.linux-armv7l-3.7/_libheif_cffi.c:836:12: error: ‘heif_unknown_brand’ undeclared (first use in this function)
int n = (heif_unknown_brand) <= 0;
^~~~~~~~~~~~~~~~~~
build/temp.linux-armv7l-3.7/_libheif_cffi.c:836:12: note: each undeclared identifier is reported only once for each function it appears in
build/temp.linux-armv7l-3.7/_libheif_cffi.c: In function ‘_cffi_const_heif_heic’:
build/temp.linux-armv7l-3.7/_libheif_cffi.c:843:12: error: ‘heif_heic’ undeclared (first use in this function); did you mean ‘heif_writer’?
int n = (heif_heic) <= 0;
^~~~~~~~~
heif_writer
build/temp.linux-armv7l-3.7/_libheif_cffi.c: In function ‘_cffi_const_heif_heix’:
### etc etc for all the constants
It's very useful to be able to report the version of a Python module without having to use pip to determine it. It's almost always provided in version.
Also, if libheif provides a version number, providing access to that too would be very helpful.
I think the library is called libx265. Since x265 is the codec.
I think I'm having some issue with CFFI installying pyheif. Here's a very simple dockerfile that reproduces my issue:
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y python3.8 python3-pip libffi-dev libheif-dev libde265-dev
RUN pip3 install pyheif
and here's the build log: log.txt
Hi Folks. I'm running into a runtime issue with pyheif on my M1 Mac:
>>> from pyheif_pillow_opener import register_heif_opener
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/shane/Downloads/Test/tempvenv/lib/python3.9/site-packages/pyheif_pillow_opener/__init__.py", line 2, in <module>
import pyheif
File "/Users/shane/Downloads/Test/tempvenv/lib/python3.9/site-packages/pyheif/__init__.py", line 3, in <module>
import _libheif_cffi
ImportError: dlopen(/Users/shane/Downloads/Test/tempvenv/lib/python3.9/site-packages/_libheif_cffi.abi3.so, 2): Symbol not found: _heif_check_filetype
Referenced from: /Users/shane/Downloads/Test/tempvenv/lib/python3.9/site-packages/_libheif_cffi.abi3.so
Expected in: flat namespace
in /Users/shane/Downloads/Test/tempvenv/lib/python3.9/site-packages/_libheif_cffi.abi3.so
I'm happy to provide any help here to get to the bottom of this; I've already tried a bunch of things on my end and haven't had any luck. Some notes that may help figure out what's going on:
cffi
. I've tried installing that package specifying the brew header and shared library paths without any luck. I also tried the same for the pyheif
install without any luck.$ grep -R "_heif_check_filetype" /opt/homebrew/lib
Binary file /opt/homebrew/lib/libheif.dylib matches
Binary file /opt/homebrew/lib/libheif.1.dylib matches
Binary file /opt/homebrew/lib/libheif.a matches
CPATH=/opt/homebrew/include LIBRARY_PATH=/opt/homebrew/lib pip install pyheif
Any ideas? Let me know what I can do to help get to the bottom of this.
Hello,
First of all, I would like to thank you for your work. I very much appreciate that you spend your personal time on the improvement of this lib. It helps me a lot.
About the issue. Is it possible to add a wheel for python 3.9 too (I see that you distribute only for python 3.6, 3.7, and 3.8)? It's a bit complicate to install the required version of the libheif
on the servers and compile it from the source.
Thank you so much!
I use MacPorts instead of Homebrew. sudo port install libheif
puts everything under /opt/local
instead of /usr/local
.
I can confirm that pip install --global-option=build_ext --global-option="-I/opt/local/include/" --global-option="-L/opt/local/lib" pyheif
works.
Can we add -I/opt/local/include/
and L/opt/local/lib
to libheif_build.py
here?
I am following your readme to convert to jpg and it works. However; it does not seem to write the exif metadata. Once the JPG is saved to disk, the following line fails:
Image.open(file)._getexif().items()
How can I also write the exif metadata to the new JPG file?
I'm trying to use the pyheif library to convert HEIC files to JPEG, but I'm encountering an issue with the heif_decoding_options struct. When calling pyheif.read() on a HEIC file, I get the following error:
ffi.error: struct heif_decoding_options: wrong total size (cdef says 48, but C compiler says 56). fix it or use "...;" as the last field in the cdef for struct heif_decoding_options to make it flexible
I have the latest versions of libheif and pyheif installed.
libheif: 1.15.2
pyheif: 0.7.1
python: 3.9
macOS: 13.2.1
Apple M2
Here's the code I'm using to read the HEIC file:
heif_file = pyheif.read(temp_file.name)
Could you please help me understand the cause of this error and how to fix it?
Thank you!
Any idea why I get the following error when doing pyheif.read_heif(fp)
:
pyheif.error.HeifError: Code: 2, Subcode: 102, Message: "Invalid input: No 'ftyp' box"
Hi,
I'm trying to update to pyheif==0.5.0
on my macOS X Catalina (10.15.5) system and wouldn't able to. Looks like sdist removed from 0.5.0
downloadable files and only manylinux
wheels left, while that is not compatible with macOS X.
❯ python -m venv bare-pyheif
❯ ./bare-pyheif/bin/python --version
Python 3.8.4
❯ ./bare-pyheif/bin/python -m pip --version
pip 20.1.1 from /Users/playpauseandstop/Projects/shared/bare-pyheif/lib/python3.8/site-packages/pip (python 3.8)
❯ ./bare-pyheif/bin/python -m pip install pyheif==0.5.0
ERROR: Could not find a version that satisfies the requirement pyheif==0.5.0 (from versions: 0.3.1, 0.3.2, 0.4)
ERROR: No matching distribution found for pyheif==0.5.0
In same time pyheif==0.4 had *.tar.gz
file, so that version of pyheif
is installed well,
❯ ./bare-pyheif/bin/python --version
Python 3.8.4
~/Projects/shared
❯ ./bare-pyheif/bin/python -m pip install pyheif==0.4
Collecting pyheif==0.4
Using cached pyheif-0.4.tar.gz (3.9 kB)
Collecting cffi>=1.0.0
Using cached cffi-1.14.0-cp38-cp38-macosx_10_9_x86_64.whl (175 kB)
Collecting pycparser
Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Using legacy setup.py install for pyheif, since package 'wheel' is not installed.
Installing collected packages: pycparser, cffi, pyheif
Running setup.py install for pyheif ... done
Successfully installed cffi-1.14.0 pycparser-2.20 pyheif-0.4
Thanks for your help and amazing library!
Hi,
During parsing of multiple HEIC files, most files in my set are parsed correctly, however, some files do not get parsed with the following error:
/usr/local/lib/python3.6/dist-packages/pyheif/reader.py in _read_heif_handle(handle, apply_transformations, convert_hdr_to_8bit)
136 code=error.code,
137 subcode=error.subcode,
--> 138 message=_libheif_cffi.ffi.string(error.message).decode(),
139 )
140 img = p_img[0]
HeifError: Code: 2, Subcode: 130, Message: "Invalid input: Invalid pixi box: No pixi information for chroma channels."
At the same time, the image is previewed and opened normally on my Mac OS 10.15.7, so it is not a corrupted file.
Any idea what could cause this behavior?
Thanks!
0.7.1 with support for .depth_image would be great.
i try to install pyheif on Mac from pip/pip3 and getting 'libheif/heif.h' file not found error.
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-install-aV1cwO/pyheif/setup.py'"'"'; file='"'"'/private/var/folders/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-install-aV1cwO/pyheif/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/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-record-7FR4TT/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-install-aV1cwO/pyheif/
Complete output (23 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-2.7
creating build/lib.macosx-10.9-x86_64-2.7/pyheif
copying pyheif/error.py -> build/lib.macosx-10.9-x86_64-2.7/pyheif
copying pyheif/constants.py -> build/lib.macosx-10.9-x86_64-2.7/pyheif
copying pyheif/init.py -> build/lib.macosx-10.9-x86_64-2.7/pyheif
copying pyheif/reader.py -> build/lib.macosx-10.9-x86_64-2.7/pyheif
copying pyheif/writer.py -> build/lib.macosx-10.9-x86_64-2.7/pyheif
running build_ext
generating cffi module 'build/temp.macosx-10.9-x86_64-2.7/_libheif_cffi.c'
creating build/temp.macosx-10.9-x86_64-2.7
building '_libheif_cffi' extension
creating build/temp.macosx-10.9-x86_64-2.7/build
creating build/temp.macosx-10.9-x86_64-2.7/build/temp.macosx-10.9-x86_64-2.7
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c build/temp.macosx-10.9-x86_64-2.7/_libheif_cffi.c -o build/temp.macosx-10.9-x86_64-2.7/build/temp.macosx-10.9-x86_64-2.7/_libheif_cffi.o
build/temp.macosx-10.9-x86_64-2.7/_libheif_cffi.c:493:15: fatal error: 'libheif/heif.h' file not found
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-install-aV1cwO/pyheif/setup.py'"'"'; file='"'"'/private/var/folders/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-install-aV1cwO/pyheif/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/vr/v6k80qzx0dqb0s3wgtt7dgdw0000gn/T/pip-record-7FR4TT/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Hi
I have been trying to install pyheif in many different ways.
By inputting the following command lines, it comes to a dead end with errors.
% brew install libffi libheif
% pip install git+https://github.com/carsales/pyheif.git
creating build/temp.macosx-10.9-x86_64-3.9/build/temp.macosx-10.9-x86_64-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/nishimakihiroshi/opt/anaconda3/include -arch x86_64 -I/Users/nishimakihiroshi/opt/anaconda3/include -fPIC -O2 -isystem /Users/nishimakihiroshi/opt/anaconda3/include -arch x86_64 -I/usr/local/include -I/usr/include -I/opt/local/include -I/Users/nishimakihiroshi/opt/anaconda3/include/python3.9 -c build/temp.macosx-10.9-x86_64-3.9/_libheif_cffi.c -o build/temp.macosx-10.9-x86_64-3.9/build/temp.macosx-10.9-x86_64-3.9/_libheif_cffi.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
I tried to install with a virtual environment but still I get the error message saying
Thanks for your great work. I'm really looking forward to the write operation.
I have m1 pro mac book (12.0.1)
I'm try to
$ brew install libffi libheif
$ pip install git+https://github.com/carsales/pyheif.git
error :
ERROR: Command errored out with exit status 1:
command: /Users/bobby.kim/kine/KMProjectManager/venv/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-req-build-7vdioyn2/setup.py'"'"'; __file__='"'"'/private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-req-build-7vdioyn2/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-record-as4c9ncg/install-record.txt --single-version-externally-managed --compile --install-headers /Users/bobby.kim/kine/KMProjectManager/venv/include/site/python3.9/pyheif
cwd: /private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-req-build-7vdioyn2/
Complete output (25 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.9
creating build/lib.macosx-10.9-universal2-3.9/pyheif
copying pyheif/error.py -> build/lib.macosx-10.9-universal2-3.9/pyheif
copying pyheif/constants.py -> build/lib.macosx-10.9-universal2-3.9/pyheif
copying pyheif/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pyheif
copying pyheif/reader.py -> build/lib.macosx-10.9-universal2-3.9/pyheif
copying pyheif/writer.py -> build/lib.macosx-10.9-universal2-3.9/pyheif
creating build/lib.macosx-10.9-universal2-3.9/pyheif/data
copying pyheif/data/version.txt -> build/lib.macosx-10.9-universal2-3.9/pyheif/data
running build_ext
generating cffi module 'build/temp.macosx-10.9-universal2-3.9/_libheif_cffi.c'
creating build/temp.macosx-10.9-universal2-3.9
building '_libheif_cffi' extension
creating build/temp.macosx-10.9-universal2-3.9/build
creating build/temp.macosx-10.9-universal2-3.9/build/temp.macosx-10.9-universal2-3.9
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/usr/local/include -I/usr/include -I/opt/local/include -I/Users/bobby.kim/kine/KMProjectManager/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c build/temp.macosx-10.9-universal2-3.9/_libheif_cffi.c -o build/temp.macosx-10.9-universal2-3.9/build/temp.macosx-10.9-universal2-3.9/_libheif_cffi.o
build/temp.macosx-10.9-universal2-3.9/_libheif_cffi.c:570:15: fatal error: 'libheif/heif.h' file not found
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/bobby.kim/kine/KMProjectManager/venv/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-req-build-7vdioyn2/setup.py'"'"'; __file__='"'"'/private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-req-build-7vdioyn2/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/bq/jgwv45vj7cg4txj07c5hs5q40000gp/T/pip-record-as4c9ncg/install-record.txt --single-version-externally-managed --compile --install-headers /Users/bobby.kim/kine/KMProjectManager/venv/include/site/python3.9/pyheif Check the logs for full command output.
For example,
import pyheif
f = '/path/to/myfile.heif'
h = pyheif.read_heif(f)
print(type(h.metadata[0]['data']))
bytes
h.metadata[0]['data'].decode('utf-8') # ^^^ how do i read this data?
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x86 in position 27: invalid start byte
import pyheif
File "/usr/local/lib/python3.6/dist-packages/pyheif/init.py", line 1, in
from .reader import read_heif
File "/usr/local/lib/python3.6/dist-packages/pyheif/reader.py", line 1, in
from _libheif_cffi import ffi, lib
ImportError: /usr/local/lib/python3.6/dist-packages/_libheif_cffi.abi3.so: undefined symbol: heif_image_handle_get_raw_color_profile
Invalid syntax in python 3.5.6
import pyheif
../../../virtualenv/python3.5.6/lib/python3.5/site-packages/pyheif-0.3.2-py3.5-linux-x86_64.egg/pyheif/__init__.py:1: in <module>
from .reader import read_heif
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from _libheif_cffi import ffi, lib
from .constants import *
> from .error import HeifError
E File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/pyheif-0.3.2-py3.5-linux-x86_64.egg/pyheif/error.py", line 10
E return f'Code: {self.code}, Subcode: {self.subcode}, Message: "{self.message}"'
E ^
E SyntaxError: invalid syntax
sudo python3 -m pip install pyheif
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyheif
Using cached https://files.pythonhosted.org/packages/a0/b5/74e08a65b3775153f72b2bf75adf9ca48f41db207e0d21dd7c8876e413cb/pyheif-0.5.1.tar.gz
Requirement already satisfied: cffi>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from pyheif) (1.14.5)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.0.0->pyheif) (2.20)
Building wheels for collected packages: pyheif
Running setup.py bdist_wheel for pyheif ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xtenmi2m/pyheif/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 /tmp/pip-wheel-p6qido_m --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/pyheif
copying pyheif/__init__.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/writer.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/error.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/reader.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/constants.py -> build/lib.linux-armv7l-3.7/pyheif
creating build/lib.linux-armv7l-3.7/pyheif/data
copying pyheif/data/version.txt -> build/lib.linux-armv7l-3.7/pyheif/data
running build_ext
generating cffi module 'build/temp.linux-armv7l-3.7/_libheif_cffi.c'
creating build/temp.linux-armv7l-3.7
building '_libheif_cffi' extension
creating build/temp.linux-armv7l-3.7/build
creating build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.7m -c build/temp.linux-armv7l-3.7/_libheif_cffi.c -o build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7/_libheif_cffi.o
build/temp.linux-armv7l-3.7/_libheif_cffi.c:570:15: fatal error: libheif/heif.h: No such file or directory
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyheif
Running setup.py clean for pyheif
Failed to build pyheif
Installing collected packages: pyheif
Running setup.py install for pyheif ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xtenmi2m/pyheif/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-iuto___c/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/pyheif
copying pyheif/__init__.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/writer.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/error.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/reader.py -> build/lib.linux-armv7l-3.7/pyheif
copying pyheif/constants.py -> build/lib.linux-armv7l-3.7/pyheif
creating build/lib.linux-armv7l-3.7/pyheif/data
copying pyheif/data/version.txt -> build/lib.linux-armv7l-3.7/pyheif/data
running build_ext
generating cffi module 'build/temp.linux-armv7l-3.7/_libheif_cffi.c'
creating build/temp.linux-armv7l-3.7
building '_libheif_cffi' extension
creating build/temp.linux-armv7l-3.7/build
creating build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.7m -c build/temp.linux-armv7l-3.7/_libheif_cffi.c -o build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7/_libheif_cffi.o
build/temp.linux-armv7l-3.7/_libheif_cffi.c:570:15: fatal error: libheif/heif.h: No such file or directory
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xtenmi2m/pyheif/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-iuto___c/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xtenmi2m/pyheif/
Error happens when installing with pip, not sure what's going wrong.
Hi,
The current version 0.5.2 is missing arm and source upload in the PyPI.
ERROR: Failed building wheel for pyheif
Is it my problem?
The bunch of last PR was merged in strange way, so each next commit contain changes from the previous step. This is really hard to understand what exactly was merged and how correct it was. In particular, this is how this conflict was introduced.
Rollback everything. Reset master to the last correct commit which is 04d513b. Then apply PR in the following order:
Importtant: wait for resolving conflicts in PR, not try to fix this silently.
@ant32bit-carsales Are you agree?
HEIC supports more than one image in a container file. Are there plans to add multiple image support? Currently, pyheif only reads the primary image.
ERROR: Complete output from command /usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-web7qumj/pyheif/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ue570lr7/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pyheif
copying pyheif/error.py -> build/lib.linux-x86_64-3.7/pyheif
copying pyheif/reader.py -> build/lib.linux-x86_64-3.7/pyheif
copying pyheif/constants.py -> build/lib.linux-x86_64-3.7/pyheif
copying pyheif/__init__.py -> build/lib.linux-x86_64-3.7/pyheif
copying pyheif/writer.py -> build/lib.linux-x86_64-3.7/pyheif
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.7/_libheif_cffi.c'
creating build/temp.linux-x86_64-3.7
building '_libheif_cffi' extension
creating build/temp.linux-x86_64-3.7/build
creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include -I/usr/local/include/python3.7m -c build/temp.linux-x86_64-3.7/_libheif_cffi.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libheif_cffi.o
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1063:37: error: return type is an incomplete type
static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_color_profile_type':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1065:10: warning: implicit declaration of function 'heif_image_handle_get_color_profile_type'; did you mean '_cffi_d_heif_image_handle_get_color_profile_type'? [-Wimplicit-function-declaration]
return heif_image_handle_get_color_profile_type(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_color_profile_type
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1065:10: warning: 'return' with a value, in function returning void
return heif_image_handle_get_color_profile_type(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1063:37: note: declared here
static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_f_heif_image_handle_get_color_profile_type':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1073:32: error: storage size of 'result' isn't known
enum heif_color_profile_type result;
^~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1073:32: warning: unused variable 'result' [-Wunused-variable]
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_raw_color_profile':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1416:10: warning: implicit declaration of function 'heif_image_handle_get_raw_color_profile'; did you mean '_cffi_d_heif_image_handle_get_raw_color_profile'? [-Wimplicit-function-declaration]
return heif_image_handle_get_raw_color_profile(x0, x1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_raw_color_profile
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1416:10: error: incompatible types when returning type 'int' but 'struct heif_error' was expected
return heif_image_handle_get_raw_color_profile(x0, x1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_f_heif_image_handle_get_raw_color_profile':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1456:12: error: incompatible types when assigning to type 'struct heif_error' from type 'int'
{ result = heif_image_handle_get_raw_color_profile(x0, x1); }
^
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_raw_color_profile_size':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1472:10: warning: implicit declaration of function 'heif_image_handle_get_raw_color_profile_size'; did you mean '_cffi_d_heif_image_handle_get_raw_color_profile_size'? [-Wimplicit-function-declaration]
return heif_image_handle_get_raw_color_profile_size(x0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_cffi_d_heif_image_handle_get_raw_color_profile_size
build/temp.linux-x86_64-3.7/_libheif_cffi.c: At top level:
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:464:7: note: in definition of macro '_cffi_prim_int'
((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:464:22: note: in definition of macro '_cffi_prim_int'
((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:465:7: note: in definition of macro '_cffi_prim_int'
(size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:465:22: note: in definition of macro '_cffi_prim_int'
(size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:466:7: note: in definition of macro '_cffi_prim_int'
(size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:466:22: note: in definition of macro '_cffi_prim_int'
(size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:467:7: note: in definition of macro '_cffi_prim_int'
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
{ "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
^~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c:467:22: note: in definition of macro '_cffi_prim_int'
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
^~~~
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_raw_color_profile':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1417:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_f_heif_image_handle_get_color_profile_type':
build/temp.linux-x86_64-3.7/_libheif_cffi.c:1094:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-web7qumj/pyheif/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ue570lr7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-web7qumj/pyheif/```
Can we have the package for python 3.11 as a wheel?
Otherwise we are getting this message during build:
building '_libheif_cffi' extension
creating build/temp.linux-x86_64-cpython-311/build
creating build/temp.linux-x86_64-cpython-311/build/temp.linux-x86_64-cpython-311
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/opt/local/include -I/home/wafeq/venv/include -I/usr/local/include/python3.11 -c build/temp.linux-x86_64-cpython-311/_libheif_cffi.c -o build/temp.linux-x86_64-cpython-311/build/temp.linux-x86_64-cpython-311/_libheif_cffi.o
build/temp.linux-x86_64-cpython-311/_libheif_cffi.c: In function ‘_cffi_const_heif_suberror_Wrong_tile_image_pixel_depth’:
build/temp.linux-x86_64-cpython-311/_libheif_cffi.c:1761:12: error: ‘heif_suberror_Wrong_tile_image_pixel_depth’ undeclared (first use in this function); did you mean ‘_cffi_const_heif_suberror_Wrong_tile_image_pixel_depth’?
1761 | int n = (heif_suberror_Wrong_tile_image_pixel_depth) <= 0;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| _cffi_const_heif_suberror_Wrong_tile_image_pixel_depth
build/temp.linux-x86_64-cpython-311/_libheif_cffi.c:1761:12: note: each undeclared identifier is reported only once for each function it appears in
build/temp.linux-x86_64-cpython-311/_libheif_cffi.c: In function ‘_cffi_d_heif_image_handle_is_premultiplied_alpha’:
build/temp.linux-x86_64-cpython-311/_libheif_cffi.c:5529:10: warning: implicit declaration of function ‘heif_image_handle_is_premultiplied_alpha’; did you mean ‘_cffi_d_heif_image_handle_is_premultiplied_alpha’? [-Wimplicit-function-declaration]
5529 | return heif_image_handle_is_premultiplied_alpha(x0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| _cffi_d_heif_image_handle_is_premultiplied_alpha
error: command '/usr/bin/gcc' failed with exit code 1
Please note that libheif-dev
and libde265-dev
are installed. The library libffi
could not be found on the server (Debian)
Hello
Computer environment
mac os 10.15.3
python3.8.1
pip 20.0.2
libheif 1.6.2
Installation execution
pip install git + https: //github.com/david-poirier-csn/pyheif.git
Encountered a problem and asked for your assistance
The installation displays the error message as follows:
ERROR: Command errored out with exit status 1:
command: / Users / XX / venv / bin / python -c 'import sys, setuptools, tokenize; sys.argv [0] =' "'"' / private / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / pip-req -build-sof6win7 / setup.py '"'" '; _file __ =' "'"' / private / var / folders / bl / 44936q503n4ys2h1x0vlhv00000gn / T / pip-req-build-sof6win7 / setup.py '"'" '' ; f = getattr (tokenize, '"'" 'open' "'"', open) ( file __); code = f.read (). replace ('"'" '\ r \ n' "'"', '"'" '\ n' "'"'); f.close (); exec (compile (code, file, '"'" 'exec' "'"')) 'egg_info --egg-base / private / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / pip-req-build-sof6win7 / pip-egg-info
cwd: / private / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / pip-req-build-sof6win7 /
Complete output (45 lines):
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
ERROR: Command errored out with exit status 1:
command: / Users / XXX / venv / bin / python -u -c 'import sys, setuptools, tokenize; sys.argv [0] =' "'"' / private / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / pip -wheel-0oj_inl2 / pycparser / setup.py '"'" '; _file __ =' "'"' / private / var / folders / bl / 44936q503n4ys2h1x0vlhv00000gn / T / pip-wheel-0oj_inl2 / pycparser / 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 / bl / _44936q503n4ys2h1x0vlhv00000gn / T / pip-wheel-k3mivdut
cwd: / private / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / pip-wheel-0oj_inl2 / pycparser /
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for pycparser
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File "/Users/XXXXX/venv/lib/python3.8/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
subprocess.check_call (cmd)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError (retcode, cmd)
subprocess.CalledProcessError: Command '[' / Users / XXX / venv / bin / python ',' -m ',' pip ',' --disable-pip-version-check ',' wheel ',' --no- deps ',' -w ',' / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / tmpw7rslhko ',' --quiet ',' pycparser ']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/bl/_44936q503n4ys2h1x0vlhv00000gn/T/pip-req-build-sof6win7/setup.py", line 6, in
setup (
File "/Users/XXXXX/venv/lib/python3.8/site-packages/setuptools/init.py", line 143, in setup
_install_setup_requires (attrs)
File "/Users/XXXXX/venv/lib/python3.8/site-packages/setuptools/init.py", line 138, in _install_setup_requires
dist.fetch_build_eggs (dist.setup_requires)
File "/Users/XXXX/venv/lib/python3.8/site-packages/setuptools/dist.py", line 718, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve (
File "/Users/XXX/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 781, in resolve
dist = best [req.key] = env.best_match (
File "/Users/XXX/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 1066, in best_match
return self.obtain (req, installer)
File "/Users/XXX/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 1078, in obtain
return installer (requirement)
File "/Users/XXX/venv/lib/python3.8/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
return fetch_build_egg (self, req)
File "/Users/XXXXX/venv/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
raise DistutilsError (str (e))
distutils.errors.DistutilsError: Command '[' / Users / XXX / venv / bin / python ',' -m ',' pip ',' --disable-pip-version-check ',' wheel ','- no-deps ',' -w ',' / var / folders / bl / _44936q503n4ys2h1x0vlhv00000gn / T / tmpw7rslhko ',' --quiet ',' pycparser ']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Current query
Solve the article (https://zhuanlan.zhihu.com/p/89858202
) Yes reinstall the pip suite, the problem is not resolved
How to solve this problem
Thank you
Try to process this file and received an exception:
sf = pyheif.read_heif(src)
File "pyheif/reader.py", line 29, in read_heif
result = _read_heif_bytes(d, apply_transformations)
File "pyheif/reader.py", line 36, in _read_heif_bytes
result = _read_heif_context(ctx, d, apply_transformations)
File "pyheif/reader.py", line 47, in _read_heif_context
raise HeifError(code=error.code, subcode=error.subcode, message=ffi.string(error.message).decode())
Here is the HEIC file that's causing the issue:
https://www.dropbox.com/s/wixzejj7wf4vmsa/216e3c80e26e41e28cdde39e730ca933.HEIC?dl=1
Our environment is latest pyheif with libheif 1.6.0 on both Linux and OSX Catalina.
Thanks,
Alex
I mean re-write or update support. Specially metadata.
Leave encoding (image bitstream H.265 compression) support for later.
Thank you in advance.
The latest version always gets an "unsupported codec" error. The older version (0.3.3) works well.
I checked in the LICENSE but only found this:
Copyright [yyyy] [name of copyright owner]
When opening a Canon HEIF file supported by libheif 1.6.2:
i = pyheif.read_heif(image_path)
File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 29, in read_heif
result = _read_heif_bytes(d, apply_transformations)
File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 36, in _read_heif_bytes
result = _read_heif_context(ctx, d, apply_transformations)
File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 56, in _read_heif_context
result = _read_heif_handle(handle, apply_transformations)
File "/home/damon/.local/lib/python3.6/site-packages/pyheif/reader.py", line 78, in _read_heif_handle
raise HeifError(code=error.code, subcode=error.subcode, message=ffi.string(error.message).decode())
pyheif.error.HeifError: Code: 4, Subcode: 3003, Message: "Unsupported feature: Unsupported color conversion"
Let me know if you need a sample HEIF file from a Canon 1D X Mark III. (I don't own the camera, but someone who does created some for me.) They are 10 bit images.
Looking over the code I see that you use a third arg to ffi.gc
in at least 1 place. This parameter to gc wasn't added until libffi 1.10. Either the code should check the version and conditionally set the size
arg to gc
calls OR the minimum version in setup.py should be updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.