Trouble installing to MSYS2 on Windows 10
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.
EDIT: I've also tried setting up a Python 3.7 x86 environment and get the same error. Here's the output with debug turned on:
>>> import cv2
OpenCV loader: os.name="nt" platform.system()="Windows"
OpenCV loader: loading config: C:/msys64/mingw32/lib/cv2/config.py
OpenCV loader: loading config: C:/msys64/mingw32/lib/cv2/config-3.7.py
OpenCV loader: PYTHON_EXTENSIONS_PATHS=['C:/msys64/mingw32/lib/cv2/python-3.7']
OpenCV loader: BINARIES_PATHS=['C:/msys64/mingw32/lib/cv2/../../bin']
OpenCV loader: PATH=C:/msys64/mingw32/lib/cv2/../../bin;C:\msys64\mingw32\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\msys64\usr\bin\site_perl;C:\msys64\usr\bin\vendor_perl;C:\msys64\usr\bin\core_perl;C:\msys64\mingw32\bin\
OpenCV loader: replacing cv2 module
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:/msys64/mingw32/lib\cv2\__init__.py", line 90, in <module>
bootstrap()
File "C:/msys64/mingw32/lib\cv2\__init__.py", line 80, in bootstrap
import cv2
ImportError: DLL load failed: The specified module could not be found.
I've added the results, to my original post ,of trying to setup a Python 3.7 x86 environment.
just curious, why do you want (or think, you need) msys ?
MSYS2 is the recommended way to get Gtk3+ installed on Windows. Gtk3+ is a must for this project. If I could get Gtk3+ installed on Anaconda, I would rather use that environment.