FZJ-INM1-BDA / celldetection-napari

Apache License 2.0
4 stars 1 forks source link

Problem with PublicOnlyProxy #1

Open guiwitz opened 5 months ago

guiwitz commented 5 months ago

Hi,

I wanted to try out your plugin but ran in the following issue when trying to run the plugin with napari -w celldetection-napari:

Traceback (most recent call last):
  File "/Users/gw18g940/mambaforge/envs/cpn/bin/napari", line 10, in <module>
    sys.exit(main())
  File "/Users/gw18g940/mambaforge/envs/cpn/lib/python3.10/site-packages/napari/__main__.py", line 570, in main
    _run()
  File "/Users/gw18g940/mambaforge/envs/cpn/lib/python3.10/site-packages/napari/__main__.py", line 379, in _run
    viewer.window.add_plugin_dock_widget(pname, tabify=tabify)
  File "/Users/gw18g940/mambaforge/envs/cpn/lib/python3.10/site-packages/napari/_qt/qt_main_window.py", line 897, in add_plugin_dock_widget
    wdg = _instantiate_dock_widget(
  File "/Users/gw18g940/mambaforge/envs/cpn/lib/python3.10/site-packages/napari/_qt/qt_main_window.py", line 1551, in _instantiate_dock_widget
    return wdg_cls(**kwargs)
  File "/Users/gw18g940/mambaforge/envs/cpn/lib/python3.10/site-packages/celldetection_napari/plugin.py", line 133, in __init__
    image_combo.setModel(co.ItemModel(layer_model, self))
  File "/Users/gw18g940/mambaforge/envs/cpn/lib/python3.10/site-packages/celldetection_napari/components.py", line 21, in __init__
    self.setSourceModel(layers)
TypeError: setSourceModel(self, sourceModel: typing.Optional[QAbstractItemModel]): argument 1 has unexpected type 'PublicOnlyProxy'

Here my napari info in case it helps:

napari: 0.4.19.post1
Platform: macOS-14.3.1-arm64-arm-64bit
System: MacOS 14.3.1
Python: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:51:49) [Clang 16.0.6 ]
Qt: 5.15.8
PyQt5: 5.15.9
NumPy: 1.26.4
SciPy: 1.12.0
Dask: 2024.3.1
VisPy: 0.14.2
magicgui: 0.8.1
superqt: 0.6.3
in-n-out: 0.2.0
app-model: 0.2.6
npe2: 0.7.5

OpenGL:
- GL version: 2.1 Metal - 88
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1512x982, scale 2.0

I strictly followed the installation instructions and napari itself works without problem.

ericup commented 5 months ago

Hi,

Thank you very much for reporting this issue!

It seems that there is indeed a compatibility problem with newer versions of napari. Until this issue is resolved, I'd recommend using napari version 0.4.17 with our plugin. This version is now also listed in the requirements.txt.

raiblelab commented 2 months ago

I also am not able to open the plug-in:

File "/../miniconda3/envs/cell_detect_env/bin/napari", line 10, in <module>
    sys.exit(main())
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/napari/__main__.py", line 561, in main
    _run()
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/napari/__main__.py", line 312, in _run
    _npe2.get_widget_contribution(
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/napari/plugins/_npe2.py", line 125, in get_widget_contribution
    return contrib.get_callable(), contrib.display_name
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/npe2/manifest/contributions/_widgets.py", line 49, in get_callable
    func = super().get_callable()
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/npe2/manifest/utils.py", line 71, in get_callable
    return _registry.get(self.command)
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/npe2/_command_registry.py", line 138, in get
    return self._commands[id].resolve()
  File "/../miniconda3/envs/cell_detect_env/lib/python3.10/site-packages/npe2/_command_registry.py", line 34, in resolve
    raise RuntimeError(
RuntimeError: Failed to import command at 'celldetection_napari.plugin:CellDetectionWidget': cannot import name 'ValidationInfo' from 'pydantic'

and my Napari as installed

napari: 0.4.17
Platform: macOS-14.3.1-arm64-arm-64bit
System: MacOS 14.3.1
Python: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:51:49) [Clang 16.0.6 ]
Qt: 5.15.8
PyQt5: 5.15.9
NumPy: 1.26.4
SciPy: 1.14.0
Dask: 2024.7.0
VisPy: 0.11.0
magicgui: 0.8.3
superqt: 0.6.7
in-n-out: 0.2.1
app-model: 0.2.7
npe2: 0.7.6

OpenGL:
- GL version: 2.1 Metal - 88
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 2560x1440, scale 2.0
- screen 2: resolution 1512x982, scale 2.0
ericup commented 2 months ago

Thanks for letting me know! There seems to be a problem with this particular version combination. I updated a couple of things, s.t. it should work now with the newest versions.

Please try it again with a fresh installation of the plugin, along with napari and its dependencies:

pip install git+https://github.com/FZJ-INM1-BDA/celldetection-napari.git