Ask Your Question
0

Trouble installing to MSYS2 on Windows 10

asked 2019-05-10 10:23:12 -0600

gpraceman gravatar image

updated 2019-05-16 12:48:59 -0600

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.
edit retag flag offensive close merge delete

Comments

I've added the results, to my original post ,of trying to setup a Python 3.7 x86 environment.

gpraceman gravatar imagegpraceman ( 2019-05-16 12:49:49 -0600 )edit

just curious, why do you want (or think, you need) msys ?

berak gravatar imageberak ( 2019-05-16 13:17:26 -0600 )edit

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.

gpraceman gravatar imagegpraceman ( 2019-05-16 13:29:41 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-05-28 20:32:36 -0600

gpraceman gravatar image

Someone helped me on another site. Turns out there are some "optional" dependencies that need to be installed.

64 bit:

pacman -S --needed mingw-w64-x86_64-ceres-solver mingw-w64-x86_64-hdf5 mingw-w64-x86_64-python2-numpy mingw-w64-x86_64-python3-numpy mingw-w64-x86_64-ogre3d mingw-w64-x86_64-tesseract-ocr

32 bit:

pacman -S --needed mingw-w64-i686-ceres-solver mingw-w64-i686-hdf5 mingw-w64-i686-python2-numpy mingw-w64-i686-python3-numpy mingw-w64-i686-ogre3d mingw-w64-i686-tesseract-ocr

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-05-10 10:23:12 -0600

Seen: 2,538 times

Last updated: May 28 '19