Module 'cv2' has no attribute 'INTER_AREA'

I have problem starting zoneminder command when it gives error AttributeError: module ‘cv2’ has no attribute ‘INTER_AREA’

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py 1 1
Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 15, in <module>
    import imutils
  File "/usr/local/lib/python3.10/dist-packages/imutils/__init__.py", line 8, in <module>
    from .convenience import translate
  File "/usr/local/lib/python3.10/dist-packages/imutils/convenience.py", line 65, in <module>
    def resize(image, width=None, height=None, inter=cv2.INTER_AREA):
AttributeError: module 'cv2' has no attribute 'INTER_AREA'

Ubuntu 22.04.2 LTS
ZoneMinder v1.36.33
Opencv 4.8 ( CUDA Version: 12.1 )
Python 3.10.6

$ pip list | grep opencv

and better call that with sudo -u www-data too, because who knows how many pythons are on your system and what virtual environments you might have enabled in your own user login.

I compiled and installed opencv according to this tutorial
And all the steps were done correctly (because I want to use gpu)

I searched a lot about it, but I don’t know how to solve this problem

(opencv_cuda)root@lin:
python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux

import cv2
cv2.version
‘4.8.0’

(opencv_cuda) root@lin:~# sudo -u www-data pip list | grep opencv
WARNING: The directory ‘/var/www/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo’s -H flag.

if you have trouble with that tutorial, you should contact the author for suupport.

the point of asking you for a pip list is to see if you have conflicting packages. there must be exactly one opencv package, not more.

please figure out how to get that list.

please run your code normally, not as a different user.

debug this. figure out what changes affect the outcome.

1 Like

no, this here isn’t an IDE issue. this here is an actual execution issue.