I tried to add the directory with the function you told me, but it seems the error still persists
import os
# gstreamer bin path
os.add_dll_directory(r"D:\gstreamer\1.0\mingw_x86_64\bin")
# nvidia cuda bin path
os.add_dll_directory(r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin")
# opencv build path
os.add_dll_directory(r"D:\NICE\Computer Vision\build-opencv-manual\build\bin")
import cv2
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[1], line 6
3 os.add_dll_directory(r"D:\gstreamer\1.0\mingw_x86_64\bin")
4 os.add_dll_directory(r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin")
----> 6 import cv2
File c:\Users\NICE\AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\__init__.py:181
176 if DEBUG: print("Extra Python code for", submodule, "is loaded")
178 if DEBUG: print('OpenCV loader: DONE')
--> 181 bootstrap()
File c:\Users\NICE\AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\__init__.py:153, in bootstrap()
149 if DEBUG: print("Relink everything from native cv2 module to cv2 package")
151 py_module = sys.modules.pop("cv2")
--> 153 native_module = importlib.import_module("cv2")
155 sys.modules["cv2"] = py_module
156 setattr(py_module, "_native", native_module)
File c:\Users\NICE\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py:90, in import_module(name, package)
88 break
89 level += 1
---> 90 return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing cv2: The specified module could not be found.
I also tried using dependency walker to check which .dll files are missing, and it seems that I’m missing a lot of stuff.
I also checked the .pyd file that is built normally (without Gstreamer, without any failed notifications in Visual Studio when building, and is able to be imported just fine to the python environment), and the dependency walker also showed many .dll files are missing.
You can see the comparison in this picture between the .pyd file I built with Gstreamer, vs the normally built .pyd file without GStreamer
Could it be that the 1 component which failed to build caused this issue?
