Skip to content

Travis Windows: ImportError: DLL load failed: The specified module could not be found. #263

Closed
@pfaion

Description

@pfaion

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 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions