I'm having problems with OpenCV with MSYS2 on Windows 10 x64 and Python 3.7. I can get OpenCV to install, but when I run a simple test script, it throws an exception.
$ python3 C:\\msys64\\home\\gpraceman\\gtk_test.py
C:/msys64/mingw64/lib/python3.7\importlib\_bootstrap.py:219: Warning: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for
testing. You are advised not to use it for production.
CRASHES ARE TO BE EXPECTED - PLEASE REPORT THEM TO NUMPY DEVELOPERS
return f(*args, **kwds)
Traceback (most recent call last):
File "C:\msys64\home\gpraceman\gtk_test.py", line 1, in <module>
import cv2
File "C:/msys64/mingw64/lib\cv2\__init__.py", line 89, in <module>
bootstrap()
File "C:/msys64/mingw64/lib\cv2\__init__.py", line 79, in bootstrap
import cv2
ImportError: DLL load failed: The specified module could not be found.
Below is how I installed OpenCV, which installs version 4.0.1. I also tried with PIP, but it wouldn't install at all (Could not find a version that satisfies the requirement opencv-python).
pacman -S mingw-w64-x86_64-opencv
I found the cv2 folder and OpenCV DLLs under C:\msys64\mingw64\lib. I did add that location to my Windows path.
I also tried setting up Anaconda and was able to get OpenCV to work, however, I could not get Gtk3+ to install and that is a requirement for my project. Gtk3+ works on MSYS2. I even tried copying the cv2 and opencv_python folders from site-packages on Anaconda over to MSYS2 but no joy. If I copied over the Gtk3+ files to Anaconda no joy again. So, I cannot get either environment to fully work for my project.