Bayer-Group / paquo

PAthological QUpath Obsession - QuPath and Python conversations
GNU General Public License v3.0
105 stars 16 forks source link

Glib error when accessing images #72

Closed LeoMH closed 2 years ago

LeoMH commented 2 years ago

Hello, when I try to access an image I get an GLib error that crashes the program.

qp = paquo.projects.QuPathProject("./qp/project.qpproj")
img = qp.images[0]

This produces the output: (process:14712): GLib-GObject-CRITICAL **: 11:20:36.970: _g_enum_types_init: assertion 'initialized == FALSE' failed (process:14712): GLib-GObject-CRITICAL **: 11:20:36.970: _g_object_type_init: assertion 'initialized == FALSE' failed

I am running Linux. I was unable to fix this so far. Does someone have an idea what could cause this?

ap-- commented 2 years ago

Hello @LeoMH,

Can you open the Project with QuPath? Also: which version of paquo and which version of QuPath are you running?

Cheers, Andreas 😃

LeoMH commented 2 years ago

Hi Andreas, I am using version 0.5.0, but I just tried version 0.4.0 and it didn't work there either. The Problem appears with every project and they can all be opened with QuPath.

ap-- commented 2 years ago

Okay. I'll need a bit more information to be able to help:

  1. Which version of QuPath are you using?

and they can all be opened with QuPath

  1. Are you just opening the project, or also opening the image in the project? (That's what qp.images[0] does)

  2. And how did you install paquo and qupath?

  3. Can you provide the output of pip freeze (or conda env export if it's a conda environment)

Cheers, Andreas

LeoMH commented 2 years ago
  1. My QuPath version is 0.3.2.
  2. Opening the project (Creating the QuPathProject object) works fine. I can also use qp.images in a notebook, which shows the thumbnails. I only get the error when i access a specific image (either by index or by iterating over the images)
  3. I installed paquo with pip and qupath as an AUR Package
  4. I am using a clean virtual environment with just paquo installed: dynaconf==3.1.9 JPype1==1.4.0 packaging==21.3 paquo==0.5.0 pyparsing==3.0.9 Shapely==1.8.2 Also it did work fine, it stopped working some time ago, maybe this is caused by an update of a dependency? Thank you for your help!
ap-- commented 2 years ago

A few things are still a bit unclear to me.

Can you confirm for the project for which qp.images[0] fails, that when you manually open QuPath without using paquo, it is possible to access the Image that fails in paquo (and for example zoom in on it in the GUI).

Also, please try using paquo with a version of QuPath from the official website, to see if it reproduces the error. Easiest way:

# store this file as test_script.py
import sys
import paquo
from paquo.jpype_backend import find_qupath
from paquo._config import to_kwargs, settings
print("PY", sys.version_info)
print("find_qupath", find_qupath(**to_kwargs(settings)))
qp = paquo.projects.QuPathProject(sys.argv[1])
img = qp.images[0]
# run this in your terminal
paquo get_qupath --install-path "/some/path/on/your/machine" 0.3.2
PAQUO_QUPATH_DIR=/some/path/on/your/machine/QuPath-0.3.2 python test_script.py ./qp/proj.qpproj

And please provide the full output including tracebacks etc.

LeoMH commented 2 years ago

The Project works fine in QuPath. I put the path to the project into the code directly. Also just using img = qp.images[0] apparently works when run as a script. I only used notebooks before. But when I added h = img.hierarchy it reproduces the error. It seems that the new installation fixed the error.

~/fixqp via  v3.10.5 ❯ PAQUO_QUPATH_DIR=/home/leo/fixqp/QuPath/QuPath-0.3.2 python test_script.py
PY sys.version_info(major=3, minor=10, micro=5, releaselevel='final', serial=0)
find_qupath (PosixPath('/home/leo/fixqp/QuPath/QuPath-0.3.2/lib/app'), PosixPath('/home/leo/fixqp/QuPath/QuPath-0.3.2/lib/runtime'), PosixPath('/home/leo/fixqp/QuPath/QuPath-0.3.2/lib/runtime/lib/server/libjvm.so'), ['-XX:MaxRAMPercentage=50', '-Djava.library.path=/home/leo/fixqp/QuPath/QuPath-0.3.2/lib/app'])

Thanks again for your help, I guess I need to do a fresh install.

ap-- commented 2 years ago

So if I understand you correctly, it works with the test script 🎉

My guess is that it works because the test script is using the freshly downloaded QuPath from the original source. I would guess that the AUR package might be somehow incompatible with the current paquo version. The original installer ships with a JVM and is completely self contained.

Cheers, Andreas :smiley:

LeoMH commented 2 years ago

Yes, I installed it manually and now it works. Thanks!