bauerdavid / napari-nD-annotator

BSD 3-Clause "New" or "Revised" License
29 stars 2 forks source link

RuntimeError: Failed to import command at 'napari_nd_annotator:ListWidgetBB': 'numpy._DTypeMeta' object is not subscriptable #46

Closed marbre2 closed 1 year ago

marbre2 commented 1 year ago

Hello, I got inspired by the blog post : https://focalplane.biologists.com/2023/03/30/annotating-3d-images-in-napari/ and wanted to try out the napari-nD-annotator. I suspect some incompatibilities of packages but could not find anything wrong. I hope you could help me to investigate the issue. Thank you in advance for your time and support,

Marine


**Describe the bug**
I followed the instructions from the webpage: https://www.napari-hub.org/plugins/napari-nD-annotator.
Since I have already a napari virtual environment (devbio-napari-env), I installed the napari-nD-annotator from the terminal.
Then I typed in the instructions `napari -w napari-nD-annotator "Object List" "Annotation Toolbox"` and immediately got a 
> Runtime Error: Failed to import command at 'napari_nd_annotator:ListWidgetBB': 'numpy._DTypeMeta' object is not subscriptable
The detailed error is in this file: [2023-08-23_Bug-napari-nD-Annotator.txt](https://github.com/bauerdavid/napari-nD-annotator/files/12416723/2023-08-23_Bug-napari-nD-Annotator.txt)

**To Reproduce**
2 possibilities:
1- to launch napari from the terminal with the options
or
2- to launch napari on its own, and then select Plugins > napari-nD-annotator > (Annotation Toolbox ) or (Slice Interpolator) or (Object List) 

**Expected behavior**
I expected the napari graphical interface to launch with the plugin one of the 3 tools from napari-nD-annotator appearing.

**napari info**
napari: 0.4.17
Platform: Windows-10-10.0.19045-SP0
Python: 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:28:38) [MSC v.1929 64 bit (AMD64)]
Qt: 5.15.6
PyQt5: 5.15.7
NumPy: 1.21.6
SciPy: 1.10.1
Dask: 2023.5.1
VisPy: 0.11.0
magicgui: 0.7.2
superqt: unknown
in-n-out: 0.1.7
app-model: 0.1.4
npe2: 0.7.0

OpenGL:
- GL version: 4.6.0 - Build 30.0.101.1404
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1080, scale 2.0
- screen 2: resolution 1920x1200, scale 1.0

**Other packages**
See the file [2023-08-23_requirements.txt](https://github.com/bauerdavid/napari-nD-annotator/files/12416658/2023-08-23_requirements.txt), to get the list of all other packages
bauerdavid commented 1 year ago

Hey @marbre2, thanks for the bug report! It seems that this is not related to this plugin, but opencv-python, see the issue here: https://github.com/opencv/opencv/issues/23822. They seem to have fixed this issue in the newest version, so try to update the opencv-python package in your virtual environment.

marbre2 commented 1 year ago

Thank you @bauerdavid for your quick reply and for pointing to me this opencv issue. I used the trick mentionned in https://github.com/opencv/opencv/issues/23822#issuecomment-1672711791 : manually editing the /usr/lib/python3/dist-packages/cv2/typing/init.py file by adding simple quote in several places. It seems to quite simply solve my issue!