Failed DLL problem when importing Python libraries in GitLab Runner Windows

Description

I am running a CI/CD pipeline that builds a python application into an executable file on Windows, and tests the successful build by running it with the -h argument.

I ran across the ImportError: DLL load failed multiples times for the tflite and opencv libraries, to the extent that now I use a testing script that simply imports those libraries and loads an element of each into a variable, to make sure the libraries are in use.

The catch is that I ran the exact project locally on a Windows 10 Enterprise virtual machine, and took the same steps of the gitlab-ci.yml file in the command line, with no issues at all.

I wonder if there is some dependency missing in the GitLab Runner Windows configuration that does not allow me to load python libraries that use vector operations, for example.

At the current stage, I limited the execution to the first stage and I cannot even run the Python application directly with the Python Interpreter, resulting in the mentioned ImportError. The tflite Wheel file is available locally in the repository.

test_imports.py
import cv2
from tflite_runtime.interpreter import Interpreter

a = cv2.resize
b = Interpreter.get_tensor
print(“Hello!”)

gitlab-ci.yml
stages:

  • build

build_windows:
tags:
- windows
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- “C:\Python37\”

before_script:
- Set-Variable -Name “time” -Value (date -Format “%HH:%mm”)
- echo ${time}
- choco install python --version=3.7.9 -y -f -no-progress
- refreshenv

script:
- “C:\Python37\python.exe -m pip install --upgrade pip”
- “C:\Python37\python.exe -m pip install -r requirements.txt”
- “C:\Python37\python.exe -m pip install python-dev”
- “C:\Python37\python.exe -m pip install tflite_runtime-2.5.0-cp37-cp37m-win_amd64.whl”
- “C:\Python37\python.exe teste_imports.py”