opencv-python: Travis Windows: ImportError: DLL load failed: The specified module could not be found.

Hi, thanks for putting all the work into this! ✨

I have an issue with using opencv-python on Travis Windows instances. Here a simple import cv2 will result in ImportError: DLL load failed: The specified module could not be found.

The problem is: this even happens with opencv-python-headless.

I prepared a small example: https://travis-ci.org/pfaion/travis-opencv-python-test/builds/614589763#L68-L72

More context

I had similar problems when loading manually compiled opencv DLLs on travis. It appears this stems from travis using a Windows server version without GUI support. For manually compiled opencv DLLs I was able to fix this by excluding all Windows GUI options in cmake for OpenCV:

...
    -DWITH_WIN32UI=OFF\
    -DWITH_DSHOW=OFF\
    -DWITH_MSMF=OFF\
    -DWITH_DIRECTX=OFF\
...

Now I tried to use opencv-python-headless but I still can’t load the DLL. I found a thread where other people reported this problem in a travis forum: https://travis-ci.community/t/python-and-opencv-dll-load-fails-every-time/4431/6

Apparently someone already figured out the cause of the problem here:

opencv-python-headless gives the same result because this is a result of OpenCV-Python being linked with AVFoundation support 1.

So I assume this is just a flag that was not turned off correctly for the headless build? I quickly searched through the issues, but could not found it, so here it is 🙂

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

FYI, we have added plug-in mode support for Media Foundation backend in OpenCV: https://github.com/opencv/opencv/pull/17009 It means that MSMF will become optional dependency and it will be possible to create single binary for platforms with and without Media Foundation. However this feature did not get into 4.3.0 release and have not been thoroughly tested yet.