install fail 'windowsmediaphoto.h' file not found
dprat opened this issue · comments
I've been struggling to install the package with pip.
I'm under M1 MacOS Ventura 13.1 and Python 3.11.2
/homebrew/Cellar/little-cms2/2.13.1_1/include -I/opt/homebrew/Cellar/libdeflate/1.18/include -I/opt/homebrew/Cellar/giflib/5.2.1/include -I/opt/homebrew/Cellar/libheif/1.12.0_2/include -I/opt/homebrew/Cellar/openjpeg/2.5.0/include/openjpeg-2.5 -I/opt/libjpeg-turbo/include/ -I/opt/homebrew/Cellar/openssl@3/3.0.3/include -D__ANSI__=1 -Iimagecodecs -I/usr/include/jxrlib -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -I/opt/homebrew/lib/python3.11/site-packages/numpy/core/include -c imagecodecs/_jpegxr.c -o build/temp.macosx-13-arm64-cpython-311/imagecodecs/_jpegxr.o
In file included from imagecodecs/_jpegxr.c:746:
In file included from /opt/homebrew/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5:
In file included from /opt/homebrew/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /opt/homebrew/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940:
/opt/homebrew/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
^
imagecodecs/_jpegxr.c:756:10: fatal error: 'windowsmediaphoto.h' file not found
#include "windowsmediaphoto.h"
^~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
How can I solve that ?
Many thanks
Edit1:
After some investigations I tried to install from the source and to comment out _jpegxr.c
from l.756 :
// #include "windowsmediaphoto.h"
// #include "guiddef.h"
// #include "JXRMeta.h"
Now I end up with problem from the libtiff :
imagecodecs/_tiff.c:4919:3: error: use of undeclared identifier 'TIFFOpenOptions'
TIFFOpenOptions *__pyx_v_openoptions;
^
imagecodecs/_tiff.c:4919:20: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
TIFFOpenOptions *__pyx_v_openoptions;
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5062:3: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
__pyx_v_openoptions = NULL;
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5062:23: error: cannot assign to variable '__pyx_k_openoptions' with const-qualified type 'const char[12]'
__pyx_v_openoptions = NULL;
~~~~~~~~~~~~~~~~~~~ ^
imagecodecs/_tiff.c:2913:19: note: variable '__pyx_k_openoptions' declared const here
static const char __pyx_k_openoptions[] = "openoptions";
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imagecodecs/_tiff.c:5827:11: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
__pyx_v_openoptions = TIFFOpenOptionsAlloc();
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5827:33: error: implicit declaration of function 'TIFFOpenOptionsAlloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
__pyx_v_openoptions = TIFFOpenOptionsAlloc();
^
imagecodecs/_tiff.c:5827:31: error: cannot assign to variable '__pyx_k_openoptions' with const-qualified type 'const char[12]'
__pyx_v_openoptions = TIFFOpenOptionsAlloc();
~~~~~~~~~~~~~~~~~~~ ^
imagecodecs/_tiff.c:2913:19: note: variable '__pyx_k_openoptions' declared const here
static const char __pyx_k_openoptions[] = "openoptions";
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imagecodecs/_tiff.c:5836:25: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
__pyx_t_6 = ((__pyx_v_openoptions == NULL) != 0);
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5898:11: error: implicit declaration of function 'TIFFOpenOptionsSetErrorHandlerExtR' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
TIFFOpenOptionsSetErrorHandlerExtR(__pyx_v_openoptions, __pyx_f_11imagecodecs_5_tiff_tif_error_handler, ((void *)__pyx_v_memtif));
^
imagecodecs/_tiff.c:5898:46: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
TIFFOpenOptionsSetErrorHandlerExtR(__pyx_v_openoptions, __pyx_f_11imagecodecs_5_tiff_tif_error_handler, ((void *)__pyx_v_memtif));
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5907:11: error: implicit declaration of function 'TIFFOpenOptionsSetWarningHandlerExtR' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
TIFFOpenOptionsSetWarningHandlerExtR(__pyx_v_openoptions, __pyx_f_11imagecodecs_5_tiff_tif_warning_handler, ((void *)__pyx_v_memtif));
^
imagecodecs/_tiff.c:5907:11: note: did you mean 'TIFFOpenOptionsSetErrorHandlerExtR'?
imagecodecs/_tiff.c:5898:11: note: 'TIFFOpenOptionsSetErrorHandlerExtR' declared here
TIFFOpenOptionsSetErrorHandlerExtR(__pyx_v_openoptions, __pyx_f_11imagecodecs_5_tiff_tif_error_handler, ((void *)__pyx_v_memtif));
^
imagecodecs/_tiff.c:5907:48: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
TIFFOpenOptionsSetWarningHandlerExtR(__pyx_v_openoptions, __pyx_f_11imagecodecs_5_tiff_tif_warning_handler, ((void *)__pyx_v_memtif));
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5916:25: error: implicit declaration of function 'TIFFClientOpenExt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
__pyx_v_tif = TIFFClientOpenExt(((char const *)"memtif"), ((char const *)"r"), ((thandle_t)__pyx_v_memtif), __pyx_f_11imagecodecs_5_tiff_memtif_TIFFReadProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFWriteProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFSeekProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFCloseProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFSizeProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFMapFileProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFUnmapFileProc, __pyx_v_openoptions);
^
imagecodecs/_tiff.c:5916:25: note: did you mean 'TIFFClientOpen'?
/opt/homebrew/Cellar/libtiff/4.4.0_1/include/tiffio.h:455:14: note: 'TIFFClientOpen' declared here
extern TIFF* TIFFClientOpen(const char*, const char*,
^
imagecodecs/_tiff.c:5916:479: error: use of undeclared identifier '__pyx_v_openoptions'
__pyx_v_tif = TIFFClientOpenExt(((char const *)"memtif"), ((char const *)"r"), ((thandle_t)__pyx_v_memtif), __pyx_f_11imagecodecs_5_tiff_memtif_TIFFReadProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFWriteProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFSeekProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFCloseProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFSizeProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFMapFileProc, __pyx_f_11imagecodecs_5_tiff_memtif_TIFFUnmapFileProc, __pyx_v_openoptions);
^
imagecodecs/_tiff.c:5987:11: error: implicit declaration of function 'TIFFOpenOptionsFree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
TIFFOpenOptionsFree(__pyx_v_openoptions);
^
imagecodecs/_tiff.c:5987:11: note: did you mean 'TIFFOpenOptionsAlloc'?
imagecodecs/_tiff.c:5827:33: note: 'TIFFOpenOptionsAlloc' declared here
__pyx_v_openoptions = TIFFOpenOptionsAlloc();
^
imagecodecs/_tiff.c:5987:31: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
TIFFOpenOptionsFree(__pyx_v_openoptions);
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5996:11: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
__pyx_v_openoptions = NULL;
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
^
imagecodecs/_tiff.c:5996:31: error: cannot assign to variable '__pyx_k_openoptions' with const-qualified type 'const char[12]'
__pyx_v_openoptions = NULL;
~~~~~~~~~~~~~~~~~~~ ^
imagecodecs/_tiff.c:2913:19: note: variable '__pyx_k_openoptions' declared const here
static const char __pyx_k_openoptions[] = "openoptions";
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imagecodecs/_tiff.c:8042:21: error: use of undeclared identifier '__pyx_v_openoptions'; did you mean '__pyx_k_openoptions'?
__pyx_t_6 = ((__pyx_v_openoptions != NULL) != 0);
^~~~~~~~~~~~~~~~~~~
__pyx_k_openoptions
imagecodecs/_tiff.c:2913:19: note: '__pyx_k_openoptions' declared here
static const char __pyx_k_openoptions[] = "openoptions";
edit3:
I finally found out the problem with libtiff. The one installed from homebrew was missing the declaration of TIFFOpenOptions
from the tiffio.h
I solved the problem by reinstalling the library from source : https://gitlab.com/libtiff/libtiff/-/tree/master
This look similar to #49, building from source for Apple silicon with libraries from homebrew. Unfortunately no one provided a customize_build_homebrew
function so you'll need to adjust include and library directories, and library names, via command line or imagecodecs_distributor_setup.customize_build
function. See the customize_build_macports
function for example.
Uncommenting include statements from generated Cython code won't work. The latest imagecodecs release requires libjpeg-turbo 2.1.91 and libtiff 4.5.0, which might not be available in homebrew yet.
Yes indeed it is similar.
That's what I did.
But i'm not sure to understand about uncommenting include statements since the issue was :
imagecodecs/_jpegxr.c:756:10: fatal error: 'windowsmediaphoto.h' file not found
#include "windowsmediaphoto.h"
With windowsmediaphoto
being available only on Windows distribution
windowsmediaphoto.h
is part of jxrlib
. Maybe homebrew puts it in an unusual place or forgot to ship it?
Indeed...
After hours of looking for it I finally found it !
Many thanks !