How to solve "ImportError: DLL load failed: The specified module could not be found."?

67 Views Asked by At

This is the code, I'm trying to run:

import cv2
from cvzone.HandTrackingModule import HandDetector

cap=cv2.VideoCapture(0)
detector=HandDetector(maxHands='1')

while True:
    success, img =cap.read()
    hands, img= detector.findHands(img)

    cv2.imshow("image", img)
    if cv2.waitKey(1) & 0xFF == ord(' '):
        break

and I get this error:

ImportError: DLL load failed: The specified module could not be found.

here the detailed error message:

Traceback (most recent call last):
  File "dataCollection.py", line 2, in <module>
    from cvzone.HandTrackingModule import HandDetector
  File "C:\Users\PMLS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\cvzone\HandTrackingModule.py", line 10, in <module>
    import mediapipe as mp
  File "C:\Users\PMLS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\mediapipe\__init__.py", line 15, in <module>
    from mediapipe.python import *
  File "C:\Users\PMLS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\mediapipe\python\__init__.py", line 17, in <module>
    from mediapipe.python._framework_bindings import resource_util
ImportError: DLL load failed: The specified module could not be found.

I want the hand detector to work well as it was in the video that I'm following through.

Here the solutions I've tried:

  1. Reinstalling cvzone and mediapipe [didn't work]
  2. Checked Dependencies and installed numpy, absl-py, attrs, flatbuffers, matplotlib, numpy, opencv-contrib-python, protobuf for mediapipe [didn't work]
  3. Look for dll file in mediapipe directory which I found as file named "opencv_world3410.dll" there is no other dll files. I added the path for the opencv_world3410.dll into environment variables PATH. [didn't work even after I restarted my pc] I'm also not sure if this is the required dll file ?
  4. Check versions I installed the mediapipe and cvzone just today hence these are the latest version available.
  5. Here I found out by answer here that this command pip install msvc-runtime works for some people. I've tried that too and its same error.

Is there any thing else I could try to solve the issue? here the versions of mediapipe, cvzone, cv2 and python

Python 3.7.9
mediapipe 0.9.0.1
cv2 4.9.0
cvzone 1.6.1

Please guide me on how to remove this error. Thank You in Advance.

0

There are 0 best solutions below