melonora / napari-cell-gater

A napari plugin for cell marker gating.
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Problems starting the plugin - missing positional argument 'viewer' #30

Closed kbestak closed 1 month ago

kbestak commented 1 month ago

I'm using a Mac with an M2 chip.

I followed the instructions and installed Napari and napari-cell-gater with:

conda create -y -n napari-env -c conda-forge python=3.10
conda activate napari-env
pip install git+https://github.com/melonora/napari-cell-gater.git@stable
pip install -U 'napari[all]' 

and opened Napari with napari.

In the Plugins drop down menu I selected load_sample_data (napari-cell-gater) and it gives this error:

File ~/miniconda3/envs/napari-env/lib/python3.10/site-packages/napari/_qt/menus/plugins_menu.py:105, in PluginsMenu._add_plugin_actions.<locals>._add_toggle_widget(key=('napari-cell-gater', 'load_sample_data'), hook_type='dock')
    102     return
    104 if hook_type == 'dock':
--> 105     self._win.add_plugin_dock_widget(*key)
        key = ('napari-cell-gater', 'load_sample_data')
        self._win = <napari._qt.qt_main_window.Window object at 0x31f8e0af0>
        self = <napari._qt.menus.plugins_menu.PluginsMenu object at 0x320329480>
    106 else:
    107     self._win._add_plugin_function_widget(*key)

File ~/miniconda3/envs/napari-env/lib/python3.10/site-packages/napari/_qt/qt_main_window.py:897, in Window.add_plugin_dock_widget(self=<napari._qt.qt_main_window.Window object>, plugin_name='napari-cell-gater', widget_name='load_sample_data', tabify=False)
    894         wdg = wdg._magic_widget
    895     return dock_widget, wdg
--> 897 wdg = _instantiate_dock_widget(
        Widget = <class 'cell_gater.widgets.sample_widget.SampleWidget'>
        self = <napari._qt.qt_main_window.Window object at 0x31f8e0af0>
    898     Widget, cast('Viewer', self._qt_viewer.viewer)
    899 )
    901 # Add dock widget
    902 dock_kwargs.pop('name', None)

File ~/miniconda3/envs/napari-env/lib/python3.10/site-packages/napari/_qt/qt_main_window.py:1551, in _instantiate_dock_widget(wdg_cls=<class 'cell_gater.widgets.sample_widget.SampleWidget'>, viewer=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}))
   1546             break
   1547         # cannot look for param.kind == param.VAR_KEYWORD because
   1548         # QWidget allows **kwargs but errs on unknown keyword arguments
   1549 
   1550 # instantiate the widget
-> 1551 return wdg_cls(**kwargs)
        kwargs = {}
        wdg_cls = <class 'cell_gater.widgets.sample_widget.SampleWidget'>

TypeError: SampleWidget.__init__() missing 1 required positional argument: 'viewer'
melonora commented 1 month ago

ah I gave @josenimo already the solution for that. I think he implemented the change locally though and didn't push it yet to main.

josenimo commented 1 month ago

I will work on it today, also on clearing the orphaned forks and branches, so that we have only this repo

josenimo commented 1 month ago

@kbestak done, please reinstall and check. Also I have removed the stable branch, will modify the README so that users use the main branch

kbestak commented 1 month ago

Works for me now, thanks for such a quick resolution!