royerlab / napari-segment-anything

Segment Anything Model (SAM) native Qt UI
Apache License 2.0
190 stars 17 forks source link

Napari "quits unexpectedly" when trying to start the plugin #24

Open comatose-tortoise opened 5 months ago

comatose-tortoise commented 5 months ago

Sonoma 14.4 M3 Max

Tried running this in three different conda envs, with both the dev version and standard version. One of the envs is a completely clean env with only Napari and napari-segment-anything installed.

When I click on the plugin in the plugin dropdown, Napari shuts down with the error message in the clean env being:

/opt/homebrew/Caskroom/miniforge/base/envs/napari-sam/lib/python3.10/site-packages/napari/components/viewer_model.py:10: FutureWarning: Labels.color is deprecated since 0.4.19 and will be removed in 0.5.0, please set Labels.colormap directly with an instance of napari.utils.colormaps.DirectLabelColormap instead.!

But that warning does seem to have anything to do with the closing of Napari as far as I can tell.

JoOkuma commented 5 months ago

Hi @comatose-tortoise ,

Could you try deleting the directory at $HOME/.cache/napari-segment-anything?

Your weights could have been corrupted by closing Napari or a crash during the download, and now it's loading corrupted weights and crashing.

superresolusian commented 3 months ago

Hi @JoOkuma

I'm having a similar problem I'm afraid - clean environment with just napari and napari-segment-anything in, using pyqt5 backend and Mac M1/Monterey 12.5.

I tried deleting the cache as described above but it didn't help - the behaviour is that after cache deletion and opening plugin from napari plugins menu, SAM layers are generated and download initiates. Once the download completes, napari crashes with no error message. Following this, napari always crashes instantly when Segment Anything is selected from the plugins menu.

The behaviour is the same both from the command line and through the napari GUI.

Let me know if you need more information from me!

Many thanks, Siân

JoOkuma commented 3 months ago

Hi @superresolusian , could you try the solution on #27 since you're using an M1 laptop?

superresolusian commented 3 months ago

Hi @JoOkuma - just tried that (installed into the napari-segment-anything environment I created previously), same problem unfortunately, just crashing without giving any error messages. It's definitely a Mac thing, I tried the recommended install on a Windows machine and it worked fine. So I do now have a Windows machine it works on so I can test my data now, but happy to try any recommended fixes/provide more information on the Mac side if it's helpful for debugging from your end :)