Open gregster7 opened 1 year ago
Hi @gregster7,
Have you installed the libvips binary? Homebrew is probably the simplest way to do this on mac.
You can verify that you have openslide enabled with:
$ vips --vips-config | grep -i opensl
OpenSlide load: true (dynamic module: true)
And verify that pyvips found the libvips headers with:
$ python3
Python 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvips
>>> pyvips.API_mode
True
>>>
You might need to set PKG_CONFIG_PATH
before installing with pip to get it to see the libvips headers.
Hi @jcupitt
Thank you for the help. Dynamic module is not enabled. Do I need to enable this 'dynamic module' and if so how?
vips --vips-config | grep -i opensl
OpenSlide load: yes (dynamic module: no)
The rest seems correct:
Python 3.7.7 (default, Mar 23 2020, 17:31:31)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvips
>>> pyvips.API_mode
True
Thank you!
No dynamic modules is fine. It sounds like everything is working, hooray!
Wait, you have openslide, but can't load SVS?
Something screwy is happening, perhaps you have several libvips installed and it's picking up the wrong one when running inside your app? Maybe try:
slide = pyvips.Image.openslideload("testfile.svs")
And see what happens.
>>> import pyvips
>>> slide = pyvips.Image.openslideload("testfile.svs")
(process:66755): GLib-CRITICAL **: 13:49:15.942: g_datalist_id_set_data_full: assertion 'key_id > 0' failed
(process:66755): GLib-GObject-CRITICAL **: 13:49:15.942: g_param_spec_pool_lookup: assertion 'pool != NULL' failed
(process:66755): GLib-GObject-WARNING **: 13:49:15.942: g_object_set_is_valid_property: object class '(null)' has no property named 'filename'
Traceback (most recent call last):
File "vips_py_test.py", line 3, in <module>
slide = pyvips.Image.openslideload("testfile.svs")
File "/Users/disco/Sandbox/2020_11_django/HemeLabel/HemeLabel_env/lib/python3.7/site-packages/pyvips/vimage.py", line 256, in call_function
return pyvips.Operation.call(name, *args, **kwargs)
File "/Users/disco/Sandbox/2020_11_django/HemeLabel/HemeLabel_env/lib/python3.7/site-packages/pyvips/voperation.py", line 305, in call
raise Error('unable to call {0}'.format(operation_name))
pyvips.error.Error: unable to call openslideload
openslideload: parameter filename not set
Hmm maybe the openslide loader isn't being initialised? What libvips version is that, and where did you get the binary?
Not sure where I got the binary - I am guessing I installed it with Brew. installed it for command line a few years ago and have happily been using it ever since without problems.
vips-8.12.2
pyvips==2.2.1
vips --vips-config enable debug: no enable deprecated library components: yes enable modules: no use fftw3 for FFT: yes accelerate loops with orc: yes ICC profile support with lcms: yes (lcms2) zlib: yes text rendering with pangocairo: yes font file support with fontconfig: yes RAD load/save: yes Analyze7 load/save: yes PPM load/save: yes GIF load: yes GIF save with cgif: yes EXIF metadata support with libexif: yes JPEG load/save with libjpeg: yes (pkg-config) JXL load/save with libjxl: yes (dynamic module: no) JPEG2000 load/save with libopenjp2: yes PNG load with libspng: yes PNG load/save with libpng: yes (pkg-config libpng >= 1.2.9) quantisation to 8 bit: yes TIFF load/save with libtiff: yes (pkg-config libtiff-4) image pyramid save: yes HEIC/AVIF load/save with libheif: yes (dynamic module: no) WebP load/save with libwebp: yes PDF load with PDFium: no PDF load with poppler-glib: yes (dynamic module: no) SVG load with librsvg-2.0: yes EXR load with OpenEXR: yes OpenSlide load: yes (dynamic module: no) Matlab load with matio: yes NIfTI load/save with niftiio: no FITS load/save with cfitsio: yes Magick package: MagickCore (dynamic module: no) Magick API version: magick7 load with libMagickCore: yes save with libMagickCore: yes
I have installed pyvips using pip on python 3.7.7 virtual environment. When I try to load an svs image at {{PATH_TO_FILE}} I get:
Not sure what to do next. Cannot install a different version of python as this is part of a large existing application.