pyvips
pyvips copied to clipboard
Installation issues mac
Hello, thanks for creating vips and providing excellent documentation.
When i do pip install pyvips
on my Mac running OS Catalina I get the following errors. I have vips version vips-8.10.4
which I installed with homebrew. I'm able to install version 2.0.5 with pip and the conda installation works likely since it comes with the prebuilt binary.
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:3428:10: error: implicit declaration of function 'vips_free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return vips_free(x0);
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:3428:10: note: did you mean 'vips_grey'?
/usr/local/include/vips/create.h:46:5: note: 'vips_grey' declared here
int vips_grey( VipsImage **out, int width, int height, ... )
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:3451:14: error: implicit declaration of function 'vips_free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
{ result = vips_free(x0); }
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:5414:28: warning: incompatible function pointer types passing 'void *(*)(uint64_t, void *, void *)' (aka 'void *(*)(unsigned long long, void *, void *)') to parameter of type 'VipsTypeMap2Fn' (aka 'void *(*)(unsigned long, void *, void *)') [-Wincompatible-function-pointer-types]
return vips_type_map(x0, x1, x2, x3);
^~
/usr/local/include/vips/object.h:619:49: note: passing argument to parameter 'fn' here
void *vips_type_map( GType base, VipsTypeMap2Fn fn, void *a, void *b );
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:5464:32: warning: incompatible function pointer types passing 'void *(*)(uint64_t, void *, void *)' (aka 'void *(*)(unsigned long long, void *, void *)') to parameter of type 'VipsTypeMap2Fn' (aka 'void *(*)(unsigned long, void *, void *)') [-Wincompatible-function-pointer-types]
{ result = vips_type_map(x0, x1, x2, x3); }
^~
/usr/local/include/vips/object.h:619:49: note: passing argument to parameter 'fn' here
void *vips_type_map( GType base, VipsTypeMap2Fn fn, void *a, void *b );
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:5904:27: warning: incompatible function pointer types passing 'void (*)(void *)' to parameter of type 'VipsCallbackFn' (aka 'int (*)(void *, void *)') [-Wincompatible-function-pointer-types]
vips_value_set_blob(x0, x1, x2, x3);
^~
/usr/local/include/vips/type.h:233:17: note: passing argument to parameter 'free_fn' here
VipsCallbackFn free_fn, const void *data, size_t length );
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:5952:29: warning: incompatible function pointer types passing 'void (*)(void *)' to parameter of type 'VipsCallbackFn' (aka 'int (*)(void *, void *)') [-Wincompatible-function-pointer-types]
{ vips_value_set_blob(x0, x1, x2, x3); }
^~
/usr/local/include/vips/type.h:233:17: note: passing argument to parameter 'free_fn' here
VipsCallbackFn free_fn, const void *data, size_t length );
^
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:6129:19: warning: incompatible pointer types initializing 'GTypeClass **' (aka 'struct _GTypeClass **') with an expression of type 'GTypeClass *' (aka 'struct _GTypeClass *') [-Wincompatible-pointer-types]
{ GTypeClass * *tmp = &p->g_type_class; (void)tmp; }
^ ~~~~~~~~~~~~~~~~
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:6192:15: warning: incompatible pointer types initializing 'uint64_t (*)[2]' with an expression of type 'union (anonymous union at /usr/local/Cellar/glib/2.66.3/include/glib-2.0/gobject/gvalue.h:114:3) (*)[2]' [-Wincompatible-pointer-types]
{ uint64_t(*tmp)[2] = &p->data; (void)tmp; }
^ ~~~~~~~~
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:6262:13: warning: incompatible pointer types initializing 'void **' with an expression of type 'VipsArgumentTable **' (aka 'struct _GHashTable **') [-Wincompatible-pointer-types]
{ void * *tmp = &p->argument_table; (void)tmp; }
^ ~~~~~~~~~~~~~~~~~~
build/temp.macosx-10.15-x86_64-3.9/_libvips.c:6292:13: warning: incompatible pointer types initializing 'void **' with an expression of type 'GTimer **' (aka 'struct _GTimer **') [-Wincompatible-pointer-types]
{ void * *tmp = &p->start; (void)tmp; }
^ ~~~~~~~~~
8 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
Hello @rajasagashe,
You're right, the latest macos update seems to have broken pyvips.
Those errors are coming from code generated by cffi. I'll see if I can pin down the cause.
Perhaps Homebrew builds libvips with --disable-deprecated
and thus removing support for the now deprecated vips_free
?
https://github.com/libvips/libvips/blob/728397d76c3d74d727b28e66356230bc97daa854/libvips/deprecated/rename.c#L816-L819
A possible solution is to remove this unused line: https://github.com/libvips/pyvips/blob/b0a151af0e0c5d2a248009d148f4484b4344db6f/pyvips/vdecls.py#L67
Yes, I've removed the old vips_free
declaration and fixed up some other stuff. It's working on my mac now.
I'll push a new version.
OK, we have 2.1.14, let me know if it works.