I’m trying to get my CI working on all 3 platforms (Win, Mac, Linux). Mac and Linux are ok, but something about Windows is giving me trouble.
Whenever import cv2
is called, which is the import for OpenCV, the build throws this error:
ImportError while importing test module
'C:\Users\travis\build\samclane\Discordia\Discordia\test\test_all.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
Discordia\test\test_all.py:14: in <module>
from Discordia.Interface.Rendering.DesktopApp import MainWindow
Discordia\Interface\Rendering\DesktopApp.py:12: in <module>
import pixelhouse as ph
c:\python37\lib\site-packages\pixelhouse\__init__.py:2: in <module>
from .canvas import Canvas, load
c:\python37\lib\site-packages\pixelhouse\canvas.py:2: in <module>
import cv2
c:\python37\lib\site-packages\cv2\__init__.py:3: in <module>
from .cv2 import *
E ImportError: DLL load failed: The specified module could not be found.
I’ve tried adding choco install opencv
, which probably helps, but it still can’t find the location. The console output from TravisCI states:
“You will need to manually create an
OPENCV_DIR
environment variable then add%OPENCV_DIR%\bin
to your PATH.
Alternately, you can rerun this and pass/Environment:C:\path\to
Follow the OpenCV instructions on their website to figure out which directory you would want.”.
So I’ve tried to EXPORT
the folder that choco claims it installed OpenCV in, /c/tools
. Here is my .travis.yaml
:
language: python # this works for Linux but is an error on macOS or Windows
matrix:
include:
- name: "Python 3.7 on Xenial Linux"
python: 3.7 # this works for Linux but is ignored on macOS or Windows
dist: xenial # required for Python >= 3.7
- name: "Python 3.7 on macOS"
os: osx
osx_image: xcode10.2 # Python 3.7.2 running on macOS 10.14.3
language: shell # 'language: python' is an error on Travis CI macOS
- name: "Python 3.7 on Windows"
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
before_install:
- choco install python
- choco install opencv # need opencv binaries
env:
- PATH=/c/Python37:/c/Python37/Scripts:/c/tools/bin:$PATH**
- OPENCV_DIR=/c/tools**
allow_failures:
- os: windows # Windows 10.0.17134 N/A Build 17134
install:
- pip3 install --upgrade pip || pip3 install --upgrade --user pip # --user is required for Windows
- pip3 install -r requirements.txt || pip3 install -r --user requirements.txt
- pip3 install pytest pytest-cov codecov || pip3 install --user pytest pytest-cov codecov # install coverage monitor
# 'python' points to Python 2.7 on macOS but points to Python 3.7 on Linux and Windows
# 'python3' is a 'command not found' error on Windows but 'py' works on Windows only
script:
- pytest --cov=./
after_success:
- codecov
I’m pretty sure I’m not adding the right OPENCV_DIR
variable in my PATH
, but I have no way of verifying specifically where it would be installed. Do I have my env. vars. correct?
Any help would be appreciated. Thanks.
EDIT: My full Build Log is here: https://travis-ci.com/samclane/Discordia/jobs/220275952