Breakthrough / DVR-Scan

:vhs: Tool for extracting scenes with motion from videos (e.g. security camera or DVR footage). Written in Python, uses OpenCV.
http://www.dvr-scan.com/
Other
362 stars 47 forks source link

Traceback TypeError for any dvr-scan command #143

Closed jgurling closed 9 months ago

jgurling commented 9 months ago

I'm running Ubuntu 22.04, Python 3.10.12. I installed dvr-scan via pip install dvr-scan[opencv]. Seemingly no issues during install. Now, no matter what dvr-scan command I run, e.g.

dvr-scan --help

I get the same Traceback error:

Traceback (most recent call last):
  File "/home/james/.local/bin/dvr-scan", line 5, in <module>
    from dvr_scan.__main__ import main
  File "/home/james/.local/lib/python3.10/site-packages/dvr_scan/__init__.py", line 41, in <module>
    import dvr_scan.opencv_loader as _
  File "/home/james/.local/lib/python3.10/site-packages/dvr_scan/opencv_loader.py", line 34, in <module>
    import cv2 as _
  File "/home/james/.local/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/james/.local/lib/python3.10/site-packages/cv2/__init__.py", line 175, in bootstrap
    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "/home/james/.local/lib/python3.10/site-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/james/.local/lib/python3.10/site-packages/cv2/typing/__init__.py", line 69, in <module>
    NumPyArrayGeneric = numpy.ndarray[typing.Any, numpy.dtype[numpy.generic]]
TypeError: 'numpy._DTypeMeta' object is not subscriptable

I'm unskilled in this. I'm not sure if this is some issue with importing cv2 package. I see from this issue that there might be some issue with package names (cv2 vs opencv-python vs opencv-contrib-python) so I tried pip install opencv-contrib-python but no change with the issue

Any ideas? TIA.

jgurling commented 9 months ago

Ahh, I came across this recent issue with opencv, tried the suggested single-quotes workaround in __init__.py file and seems to be working now! So, I think there's still an issue with opencv whose fix hasn't been released yet, but seems like this isn't an issue with dvr-scan.