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

Fresh install - closes with unexpected warning under MacOS #82

Open
horsto opened this issue Sep 7, 2024 · 6 comments
Open

Fresh install - closes with unexpected warning under MacOS #82

horsto opened this issue Sep 7, 2024 · 6 comments

Comments

@horsto
Copy link

horsto commented Sep 7, 2024

Description

Fresh install of Napari and napari-aicsimageio. Opening Tif or CZI files results in proper opening, but the application closes upon "playing" with the image / time sliders. Every single time. This happens after about 2-3 seconds when scrubbing through the data. No warning is generated.

Screenshot 2024-09-07 at 12 49 13

Environment

napari: 0.5.3
Platform: macOS-14.6.1-arm64-arm-64bit
System: MacOS 14.6.1
Python: 3.9.18 (main, Sep 11 2023, 08:25:10) [Clang 14.0.6 ]
Qt: 6.6.1
PyQt6:
NumPy: 1.24.4
SciPy: 1.9.1
Dask: 2024.8.0
VisPy: 0.14.3
magicgui: 0.9.1
superqt: 0.6.7
in-n-out: 0.2.1
app-model: 0.2.8
npe2: 0.7.7

@evamaxfield
Copy link
Collaborator

Hey! Sorry about this. I am trying my best to keep things up-to-date but I don't have a lot of time these days.

The major piece of work is actually both an upgrade to how we interact with napari and the image loading library. The branch: switch-to-bioio should be working, at least it was last time I was working on it ~2 months ago.

I don't know when I will have an update but I am trying.

@horsto
Copy link
Author

horsto commented Sep 9, 2024

Hey, thanks for your reply and don't worry. I did try the switch-to-bioio branch right now and this errors occurs upon opening a .czi (Zeiss) file. This more just to give you feedback - I don't currently rely on this plugin for anything. But count me in as tester when you continue working on it in the future.

WARNING:napari_bioio.core:BioIO: Unsupported file format.
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/components/viewer_model.py:1323, in ViewerModel._open_or_raise_error(self=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...use_drag_gen={}, _mouse_wheel_gen={}, _keymap={}), paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], kwargs={}, layer_type=None, stack=False)
   1322 try:
-> 1323     added = self._add_layers_with_plugins(
        self = Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoom=1.0, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(1.0, 1.0), scaled=True, style=<CursorStyle.STANDARD: 'standard'>, size=1.0), dims=Dims(ndim=2, ndisplay=2, order=(0, 1), axis_labels=('0', '1'), rollable=(True, True), range=(RangeTuple(start=0.0, stop=2.0, step=1.0), RangeTuple(start=0.0, stop=2.0, step=1.0)), margin_left=(0.0, 0.0), margin_right=(0.0, 0.0), point=(0.0, 0.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], help='', status='Hold <Alt> key to open plugin selection. Hold <Shift> to open files as stack.', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x17ef1c430>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={})
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        kwargs = {}
        stack = False
        plugin = 'napari-bioio'
        layer_type = None
   1324         paths,
   1325         kwargs=kwargs,
   1326         stack=stack,
   1327         plugin=plugin,
   1328         layer_type=layer_type,
   1329     )
   1330 # plugin failed

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/components/viewer_model.py:1413, in ViewerModel._add_layers_with_plugins(self=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...use_drag_gen={}, _mouse_wheel_gen={}, _keymap={}), paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], stack=False, kwargs={}, plugin='napari-bioio', layer_type=None)
   1412     assert len(paths) == 1
-> 1413     layer_data, hookimpl = read_data_with_plugins(
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        stack = False
        plugin = 'napari-bioio'
   1414         paths, plugin=plugin, stack=stack
   1415     )
   1417 if layer_data is None:

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/plugins/io.py:78, in read_data_with_plugins(paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], plugin='napari-bioio', stack=False)
     76 hookimpl: Optional[HookImplementation]
---> 78 res = _npe2.read(paths, plugin, stack=stack)
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        plugin = 'napari-bioio'
        stack = False
        _npe2 = <module 'napari.plugins._npe2' from '/Users/horst/miniconda3/envs/napari/lib/python3.10/site-packages/napari/plugins/_npe2.py'>
     79 if res is not None:

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/plugins/_npe2.py:57, in read(paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], plugin='napari-bioio', stack=False)
     56 try:
---> 57     layer_data, reader = io_utils.read_get_reader(
        io_utils = <module 'npe2.io_utils' from '/Users/horst/miniconda3/envs/napari/lib/python3.10/site-packages/npe2/io_utils.py'>
        plugin = 'napari-bioio'
        npe1_path = '/Users/horst/Downloads/Eve data/sample1/central.czi'
     58         npe1_path, plugin_name=plugin
     59     )
     60 except ValueError as e:
     61     # plugin wasn't passed and no reader was found

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/npe2/io_utils.py:66, in read_get_reader(path='/Users/horst/Downloads/Eve data/sample1/central.czi', plugin_name='napari-bioio', stack=None)
     65     new_path, new_stack = v1_to_v2(path)
---> 66     return _read(
        new_path = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        new_stack = False
        plugin_name = 'napari-bioio'
     67         new_path, plugin_name=plugin_name, return_reader=True, stack=new_stack
     68     )
     69 else:

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/npe2/io_utils.py:176, in _read(paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], stack=False, plugin_name='napari-bioio', return_reader=True, _pm=<npe2._plugin_manager.PluginManager object>)
    175 if plugin_name:
--> 176     raise ValueError(
        plugin_name = 'napari-bioio'
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
    177         f"Reader {plugin_name!r} was selected to open "
    178         + f"{paths!r}, but returned no data."
    179     )
    180 raise ValueError(f"No readers returned data for {paths!r}")

ValueError: Reader 'napari-bioio' was selected to open ['/Users/horst/Downloads/Eve data/sample1/central.czi'], but returned no data.

The above exception was the direct cause of the following exception:

ReaderPluginError                         Traceback (most recent call last)
File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:981, in QtViewer._qt_open(self=<napari._qt.qt_viewer.QtViewer object>, filenames=['/Users/horst/Downloads/Eve data/sample1/central.czi'], stack=False, choose_plugin=False, plugin=None, layer_type=None, **kwargs={})
    980 try:
--> 981     self.viewer.open(
        self = <napari._qt.qt_viewer.QtViewer object at 0x311c4b2e0>
        self.viewer = Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoom=1.0, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(1.0, 1.0), scaled=True, style=<CursorStyle.STANDARD: 'standard'>, size=1.0), dims=Dims(ndim=2, ndisplay=2, order=(0, 1), axis_labels=('0', '1'), rollable=(True, True), range=(RangeTuple(start=0.0, stop=2.0, step=1.0), RangeTuple(start=0.0, stop=2.0, step=1.0)), margin_left=(0.0, 0.0), margin_right=(0.0, 0.0), point=(0.0, 0.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], help='', status='Hold <Alt> key to open plugin selection. Hold <Shift> to open files as stack.', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x17ef1c430>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={})
        filenames = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        stack = False
        plugin = None
        layer_type = None
        kwargs = {}
    982         filenames,
    983         stack=stack,
    984         plugin=plugin,
    985         layer_type=layer_type,
    986         **kwargs,
    987     )
    988 except ReaderPluginError as e:

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/components/viewer_model.py:1223, in ViewerModel.open(self=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...use_drag_gen={}, _mouse_wheel_gen={}, _keymap={}), path=['/Users/horst/Downloads/Eve data/sample1/central.czi'], stack=False, plugin=None, layer_type=None, **kwargs={})
   1221 # no plugin choice was made
   1222 else:
-> 1223     layers = self._open_or_raise_error(
        layers = <module 'napari.layers' from '/Users/horst/miniconda3/envs/napari/lib/python3.10/site-packages/napari/layers/__init__.py'>
        self = Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoom=1.0, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(1.0, 1.0), scaled=True, style=<CursorStyle.STANDARD: 'standard'>, size=1.0), dims=Dims(ndim=2, ndisplay=2, order=(0, 1), axis_labels=('0', '1'), rollable=(True, True), range=(RangeTuple(start=0.0, stop=2.0, step=1.0), RangeTuple(start=0.0, stop=2.0, step=1.0)), margin_left=(0.0, 0.0), margin_right=(0.0, 0.0), point=(0.0, 0.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], help='', status='Hold <Alt> key to open plugin selection. Hold <Shift> to open files as stack.', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x17ef1c430>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={})
        _path = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        _stack = False
        kwargs = {}
        layer_type = None
   1224         _path, kwargs, layer_type, _stack
   1225     )
   1226     added.extend(layers)

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/components/viewer_model.py:1332, in ViewerModel._open_or_raise_error(self=Viewer(camera=Camera(center=(0.0, 0.0, 0.0), zoo...use_drag_gen={}, _mouse_wheel_gen={}, _keymap={}), paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], kwargs={}, layer_type=None, stack=False)
   1331     except Exception as e:
-> 1332         raise ReaderPluginError(
        trans = <napari.utils.translations.TranslationBundle object at 0x169c03250>
        plugin = 'napari-bioio'
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
   1333             trans._(
   1334                 'Tried opening with {plugin}, but failed.',
   1335                 deferred=True,
   1336                 plugin=plugin,
   1337             ),
   1338             plugin,
   1339             paths,
   1340         ) from e
   1341 # multiple plugins
   1342 else:

ReaderPluginError: Tried opening with napari-bioio, but failed.

The above exception was the direct cause of the following exception:

ReaderPluginError                         Traceback (most recent call last)
File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:1146, in QtViewer.dropEvent(self=<napari._qt.qt_viewer.QtViewer object>, event=<PyQt5.QtGui.QDropEvent object>)
   1138 shift_down = (
   1139     QGuiApplication.keyboardModifiers()
   1140     & Qt.KeyboardModifier.ShiftModifier
   1141 )
   1142 alt_down = (
   1143     QGuiApplication.keyboardModifiers()
   1144     & Qt.KeyboardModifier.AltModifier
   1145 )
-> 1146 self._open_from_list_of_urls_data(
        self = <napari._qt.qt_viewer.QtViewer object at 0x311c4b2e0>
        event = <PyQt5.QtGui.QDropEvent object at 0x3136f24d0>
        shift_down = <PyQt5.QtCore.Qt.KeyboardModifiers object at 0x31368d310>
        alt_down = <PyQt5.QtCore.Qt.KeyboardModifiers object at 0x31368d460>
   1147     event.mimeData().urls(),
   1148     stack=bool(shift_down),
   1149     choose_plugin=bool(alt_down),
   1150 )

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:1163, in QtViewer._open_from_list_of_urls_data(self=<napari._qt.qt_viewer.QtViewer object>, urls_list=[PyQt5.QtCore.QUrl('file:///Users/horst/Downloads/Eve data/sample1/central.czi')], stack=False, choose_plugin=False)
   1160     else:
   1161         filenames.append(url.toString())
-> 1163 self._qt_open(
        self = <napari._qt.qt_viewer.QtViewer object at 0x311c4b2e0>
        filenames = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        stack = False
        choose_plugin = False
   1164     filenames,
   1165     stack=stack,
   1166     choose_plugin=choose_plugin,
   1167 )

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:989, in QtViewer._qt_open(self=<napari._qt.qt_viewer.QtViewer object>, filenames=['/Users/horst/Downloads/Eve data/sample1/central.czi'], stack=False, choose_plugin=False, plugin=None, layer_type=None, **kwargs={})
    981     self.viewer.open(
    982         filenames,
    983         stack=stack,
   (...)
    986         **kwargs,
    987     )
    988 except ReaderPluginError as e:
--> 989     handle_gui_reading(
        filenames = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        self = <napari._qt.qt_viewer.QtViewer object at 0x311c4b2e0>
        stack = False
        layer_type = None
        kwargs = {}
    990         filenames,
    991         self,
    992         stack,
    993         e.reader_plugin,
    994         e,
    995         layer_type=layer_type,
    996         **kwargs,
    997     )
    998 except MultipleReaderError:
    999     handle_gui_reading(filenames, self, stack, **kwargs)

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/_qt/dialogs/qt_reader_dialog.py:190, in handle_gui_reading(paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], qt_viewer=<napari._qt.qt_viewer.QtViewer object>, stack=False, plugin_name='napari-bioio', error=ReaderPluginError('Tried opening with napari-bioio, but failed.'), plugin_override=False, **kwargs={'layer_type': None})
    163 """Present reader dialog to choose reader and open paths based on result.
    164
    165 This function is called whenever ViewerModel._open_or_get_error returns
   (...)
    187     Dictates whether checkbox to remember choice is unchecked by default
    188 """
    189 _path = paths[0]
--> 190 readers = prepare_remaining_readers(paths, plugin_name, error)
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        plugin_name = 'napari-bioio'
        error = ReaderPluginError('Tried opening with napari-bioio, but failed.')
    191 error_message = str(error) if error else ''
    192 readerDialog = QtReaderDialog(
    193     parent=qt_viewer,
    194     pth=_path,
   (...)
    197     persist_checked=plugin_override,
    198 )

File ~/miniconda3/envs/napari/lib/python3.10/site-packages/napari/_qt/dialogs/qt_reader_dialog.py:245, in prepare_remaining_readers(paths=['/Users/horst/Downloads/Eve data/sample1/central.czi'], plugin_name='napari-bioio', error=ReaderPluginError('Tried opening with napari-bioio, but failed.'))
    243 # if there's no other readers left, raise the exception
    244 if not readers and error:
--> 245     raise ReaderPluginError(
        trans = <napari.utils.translations.TranslationBundle object at 0x169c03250>
        paths[0] = '/Users/horst/Downloads/Eve data/sample1/central.czi'
        paths = ['/Users/horst/Downloads/Eve data/sample1/central.czi']
        len(paths) > 1 = False
        len(paths) = 1
        plugin_name = 'napari-bioio'
        error = ReaderPluginError('Tried opening with napari-bioio, but failed.')
    246         trans._(
    247             'Tried to read {path_message} with plugin {plugin}, because it was associated with that file extension/because it is the only plugin capable of reading that path, but it gave an error. Try associating a different plugin or installing a different plugin for this kind of file.',
    248             path_message=(
    249                 f'[{paths[0]}, ...]' if len(paths) > 1 else paths[0]
    250             ),
    251             plugin=plugin_name,
    252         ),
    253         plugin_name,
    254         paths,
    255     ) from error
    257 return readers

ReaderPluginError: Tried to read /Users/horst/Downloads/Eve data/sample1/central.czi with plugin napari-bioio, because it was associated with that file extension/because it is the only plugin capable of reading that path, but it gave an error. Try associating a different plugin or installing a different plugin for this kind of file.

@evamaxfield
Copy link
Collaborator

Perfect! An error that makes sense!

This is because as a part of the switch to bioio, we are now able to split apart different readers instead of them all being bundled together causing bad legal problems for us.

You should (hopefully) be able to solve this error by running pip install bioio-czi in your terminal. This installs CZI support https://github.com/bioio-devs/bioio-czi

@horsto
Copy link
Author

horsto commented Sep 9, 2024

Oh beautiful, that did work! Thanks! And its fast and seems to be stable. Cool.

@horsto horsto closed this as completed Sep 9, 2024
@evamaxfield
Copy link
Collaborator

Woohoo! Thanks for being a tester!

Going to re-open this so others who have the same issue and try these same steps.

Also, for others coming to this issue, here are the reasons for our moving to bioio: https://bioio-devs.github.io/bioio/MIGRATION.html#why-use-bioio-rather-than-aicsimageio

@evamaxfield evamaxfield reopened this Sep 9, 2024
@psobolewskiPhD
Copy link
Collaborator

I was going to check on this but hadn't gotten a chance yet. Sorry! Excited for the new hotness!

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

3 participants