Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using pyvips with libvips 8.6.2 #35

Closed
rebkwok opened this issue Mar 2, 2018 · 3 comments
Closed

Error using pyvips with libvips 8.6.2 #35

rebkwok opened this issue Mar 2, 2018 · 3 comments

Comments

@rebkwok
Copy link

rebkwok commented Mar 2, 2018

Maybe similar to #33?

I installed libvips 8.6.2 from source, with pyvips 2.1.2 (ubuntu 16.04, python 3.6), and ran into the following error using pyvips (via gdal2mbtiles, which I am in the process of upgrading to use pyvips):

  File "/venv/src/pyvips/pyvips/__init__.py", line 153, in <module>
    from .gvalue import *
  File "/venv//src/pyvips/pyvips/gvalue.py", line 26, in <module>
    class GValue(object):
  File "/venv/src/pyvips/pyvips/gvalue.py", line 60, in GValue
    pyvips.vips_lib.vips_blend_mode_get_type()
AttributeError: cffi library '_libvips' has no function, constant or global variable named 'vips_blend_mode_get_type'

I can see in gvalue.py that vips_blend_mode_get_type is only wrapped for 8.6+. Installed 8.5.9 from source and everything worked fine.

In ipython shell:

In [1]: import pkgconfig

In [2]: pkgconfig.installed('vips', '==8.6.2')
Out[2]: True

In [3]: import pyvips
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-b1ec53e8f619> in <module>()
----> 1 import pyvips

~/venv/lib/python3.6/site-packages/pyvips/__init__.py in <module>()
    151 from .base import *
    152 from .gobject import *
--> 153 from .gvalue import *
    154 from .vobject import *
    155 from .vinterpolate import *

~/venv/lib/python3.6/site-packages/pyvips/gvalue.py in <module>()
     24
     25
---> 26 class GValue(object):
     27
     28     """Wrap GValue in a Python class.

~/venv/lib/python3.6/site-packages/pyvips/gvalue.py in GValue()
     58
     59     if at_least_libvips(8, 6):
---> 60         pyvips.vips_lib.vips_blend_mode_get_type()
     61     blend_mode_type = type_from_name('VipsBlendMode')
     62

AttributeError: cffi library '_libvips' has no function, constant or global variable named 'vips_blend_mode_get_type'
@jcupitt
Copy link
Member

jcupitt commented Mar 3, 2018

It looks like your _libvips.so was generated for libvips 8.5.x. but you're using libvips 8.6.x, so it's trying to use an entry point that does not exist.

I would uninstall pyvips, install the latest libvips, then reinstall pyvips again with --no-cache-dir, to make sure that everything is regenerated.

pip uninstall pyvips
remove libvips
install latest libvips
pip install --user --no-cache-dir pyvips

Perhaps we should add another version check. The _libvips.so extension could record the version of libvips it was generated for (ie. the header version) and compare that to the version of libvips it links against at runtime.

@rebkwok
Copy link
Author

rebkwok commented Mar 3, 2018

That worked for me. I had uninstalled and reinstalled pyvips, but without --no-cache-dir. Thanks for your help.

@jcupitt
Copy link
Member

jcupitt commented Mar 3, 2018

git master pyvips now checks that the binary wrapper version matches the shared library version, and falls back to ABI mode if they don't. Hopefully that'll make this kind of error impossible.

@jcupitt jcupitt closed this as completed Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants