Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade to opencv-python 4.7 causes import error

While working on a project that uses the opencv-python module, I ended up updating it to version 4.7.0.68 from 4.6.0.66. The next time I ran my program it failed with an import error: ImportError: dlopen(path/to/my/virtualenv/lib/python3.9/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: _VTRegisterSupplementalVideoDecoderIfAvailable

After downgrading opencv-python back to 4.6.0.66 the import error went away and things went back to running without error.

Given that OpenCV 4.7 was released fairly recently and from what I can tell _VTRegisterSupplementalVideoDecoderIfAvailable is a function of macOS I'm guessing that this is some sort of compatibility bug in the new version of opencv-python. On the machine where the error occurred I'm running macOS Catalina (10.15.7).

To isolate that the issue is strictly related to opencv-python, I created a clean environment, installed opencv-python 4.7 and attempted to run a script with the single line import cv2. This failed with the same error.

This issue in an unrelated project hints that it's possible upgrading my OS may be needed.

I can live with downgrading to 4.6 but curious to know if there's an alternative solution to fix this import error.

like image 795
Adam Richard Avatar asked Sep 20 '25 07:09

Adam Richard


1 Answers

I got this problem too. The macOS Catalina 10.15.7 system seems too old for the new opencv package

pip3 install opencv-python==4.6.0.66
like image 74
schspa Avatar answered Sep 21 '25 21:09

schspa