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

module 'cv2.dnn' has no attribute 'DictValue' #1689

Closed
KumoLiu opened this issue Apr 11, 2024 · 0 comments · Fixed by Project-MONAI/MONAI#7626
Closed

module 'cv2.dnn' has no attribute 'DictValue' #1689

KumoLiu opened this issue Apr 11, 2024 · 0 comments · Fixed by Project-MONAI/MONAI#7626
Labels
bug Something isn't working

Comments

@KumoLiu
Copy link
Contributor

KumoLiu commented Apr 11, 2024

08:01:31  Running ./model_zoo/TCIA_PROSTATEx_Prostate_MRI_Anatomy_Model.ipynb
08:01:31  Checking PEP8 compliance...
08:01:32  Running notebook...
08:01:45  MONAI version: 1.3.1rc2+2.ge9a5bfe4
08:01:45  Numpy version: 1.26.4
08:01:45  Pytorch version: 2.1.0a0+29c30b1
08:01:45  MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
08:01:45  MONAI rev id: e9a5bfe4693ce490c75616a97eb0812e1828539b
08:01:45  MONAI __file__: /home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/__init__.py
08:01:45  
08:01:45  Optional dependencies:
08:01:45  Pytorch Ignite version: 0.4.11
08:01:45  ITK version: 5.3.0
08:01:45  Nibabel version: 5.2.1
08:01:45  scikit-image version: 0.22.0
08:01:45  scipy version: 1.11.1
08:01:45  Pillow version: 9.2.0
08:01:45  Tensorboard version: 2.16.2
08:01:45  gdown version: 4.7.3
08:01:45  TorchVision version: 0.16.0a0
08:01:45  tqdm version: 4.65.0
08:01:45  lmdb version: 1.4.1
08:01:45  psutil version: 5.9.4
08:01:45  pandas version: 1.5.2
08:01:45  einops version: 0.6.1
08:01:45  transformers version: 4.39.3
08:01:45  mlflow version: 2.11.3
08:01:45  pynrrd version: 1.0.0
08:01:45  clearml version: 1.15.1
08:01:45  
08:01:45  For details about installing the optional dependencies, please visit:
08:01:45      https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
08:01:45  
08:01:49  papermill  --progress-bar --log-output -k python3
08:01:49  /usr/local/lib/python3.10/dist-packages/papermill/iorw.py:153: UserWarning: the file is not specified with any extension : -
08:01:49    warnings.warn(
08:03:12  
Executing:   0%|          | 0/32 [00:00<?, ?cell/s]
Executing:   3%|▎         | 1/32 [00:01<00:58,  1.89s/cell]
Executing:  22%|██▏       | 7/32 [01:17<04:47, 11.51s/cell]
Executing:  28%|██▊       | 9/32 [01:21<03:20,  8.71s/cell]
Executing:  28%|██▊       | 9/32 [01:23<03:32,  9.23s/cell]
08:03:12  /usr/local/lib/python3.10/dist-packages/papermill/iorw.py:153: UserWarning: the file is not specified with any extension : -
08:03:12    warnings.warn(
08:03:12  Traceback (most recent call last):
08:03:12    File "/usr/local/bin/papermill", line 8, in <module>
08:03:12      sys.exit(papermill())
08:03:12    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
08:03:12      return self.main(*args, **kwargs)
08:03:12    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
08:03:12      rv = self.invoke(ctx)
08:03:12    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
08:03:12      return ctx.invoke(self.callback, **ctx.params)
08:03:12    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
08:03:12      return __callback(*args, **kwargs)
08:03:12    File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 33, in new_func
08:03:12      return f(get_current_context(), *args, **kwargs)
08:03:12    File "/usr/local/lib/python3.10/dist-packages/papermill/cli.py", line 254, in papermill
08:03:12      execute_notebook(
08:03:12    File "/usr/local/lib/python3.10/dist-packages/papermill/execute.py", line 134, in execute_notebook
08:03:12      raise_for_execution_errors(nb, output_path)
08:03:12    File "/usr/local/lib/python3.10/dist-packages/papermill/execute.py", line 241, in raise_for_execution_errors
08:03:12      raise error
08:03:12  papermill.exceptions.PapermillExecutionError: 
08:03:12  ---------------------------------------------------------------------------
08:03:12  Exception encountered at "In [2]":
08:03:12  ---------------------------------------------------------------------------
08:03:12  AttributeError                            Traceback (most recent call last)
08:03:12  Cell In[2], line 15
08:03:12       12 import pydicom_seg
08:03:12       14 # for downloading data from TCIA
08:03:12  ---> 15 from tcia_utils import nbia
08:03:12       17 # This is the most common import command for itkWidgets.
08:03:12       18 #   The view() function opens an interactive viewer for 2D and 3D
08:03:12       19 #   data in a variety of formats.
08:03:12       20 from itkwidgets import view
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/tcia_utils/__init__.py:1
08:03:12  ----> 1 from . import nbia
08:03:12        2 from . import datacite
08:03:12        3 from . import pathdb
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/tcia_utils/nbia.py:17
08:03:12       15 import pydicom
08:03:12       16 import pydicom_seg
08:03:12  ---> 17 import rt_utils
08:03:12       18 import numpy as np
08:03:12       19 from ipywidgets import interact
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/rt_utils/__init__.py:1
08:03:12  ----> 1 from .rtstruct import RTStruct
08:03:12        2 from .rtstruct_builder import RTStructBuilder
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/rt_utils/rtstruct.py:7
08:03:12        4 from pydicom.dataset import FileDataset
08:03:12        6 from rt_utils.utils import ROIData
08:03:12  ----> 7 from . import ds_helper, image_helper
08:03:12       10 class RTStruct:
08:03:12       11     """
08:03:12       12     Wrapper class to facilitate appending and extracting ROI's within an RTStruct
08:03:12       13     """
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/rt_utils/ds_helper.py:2
08:03:12        1 import datetime
08:03:12  ----> 2 from rt_utils.image_helper import get_contours_coords
08:03:12        3 from rt_utils.utils import ROIData, SOPClassUID
08:03:12        4 import numpy as np
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/rt_utils/image_helper.py:5
08:03:12        2 from typing import List
08:03:12        3 from enum import IntEnum
08:03:12  ----> 5 import cv2 as cv
08:03:12        6 import numpy as np
08:03:12        7 from pydicom import dcmread
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/cv2/__init__.py:181
08:03:12      176             if DEBUG: print("Extra Python code for", submodule, "is loaded")
08:03:12      178     if DEBUG: print('OpenCV loader: DONE')
08:03:12  --> 181 bootstrap()
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/cv2/__init__.py:175, in bootstrap()
08:03:12      172 if DEBUG: print('OpenCV loader: binary extension... OK')
08:03:12      174 for submodule in __collect_extra_submodules(DEBUG):
08:03:12  --> 175     if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
08:03:12      176         if DEBUG: print("Extra Python code for", submodule, "is loaded")
08:03:12      178 if DEBUG: print('OpenCV loader: DONE')
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/cv2/__init__.py:28, in __load_extra_py_code_for_module(base, name, enable_debug_print)
08:03:12       26 native_module = sys.modules.pop(module_name, None)
08:03:12       27 try:
08:03:12  ---> 28     py_module = importlib.import_module(module_name)
08:03:12       29 except ImportError as err:
08:03:12       30     if enable_debug_print:
08:03:12  
08:03:12  File /usr/lib/python3.10/importlib/__init__.py:126, in import_module(name, package)
08:03:12      124             break
08:03:12      125         level += 1
08:03:12  --> 126 return _bootstrap._gcd_import(name[level:], package, level)
08:03:12  
08:03:12  File /usr/local/lib/python3.10/dist-packages/cv2/typing/__init__.py:168
08:03:12      166 ExtractArgsCallback = _typing.Callable[[_typing.Sequence[GTypeInfo]], _typing.Sequence[GRunArg]]
08:03:12      167 ExtractMetaCallback = _typing.Callable[[_typing.Sequence[GTypeInfo]], _typing.Sequence[GMetaArg]]
08:03:12  --> 168 LayerId = cv2.dnn.DictValue
08:03:12      169 IndexParams = _typing.Dict[str, _typing.Union[bool, int, float, str]]
08:03:12      170 SearchParams = _typing.Dict[str, _typing.Union[bool, int, float, str]]
08:03:12  
08:03:12  AttributeError: module 'cv2.dnn' has no attribute 'DictValue'
@KumoLiu KumoLiu added the bug Something isn't working label Apr 11, 2024
KumoLiu added a commit to Project-MONAI/MONAI that referenced this issue Apr 12, 2024
Fixes [tutorial
#1689](Project-MONAI/tutorials#1689)

### Description

Uninstall opencv included in base image.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant