Search code examples
pythonopencv

ModuleNotFoundError in jupyter notebook in vs code


import os 
import cv2
import cvzone
from cvzone.PoseModule import PoseDetector  # error

Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_28992\1329371883.py in <module>
      2 import cv2
      3 import cvzone
----> 4 from cvzone.PoseModule import PoseDetector

c:\clothchangr\venv\lib\site-packages\cvzone\PoseModule.py in <module>
      7 
      8 import cv2
----> 9 import mediapipe as mp
     10 
     11 

ModuleNotFoundError: No module named 'mediapipe'

after installing opencv-python and cvzone modules in terminal in ipykernel venv (python 3.7.8) still getting an error in line 4 of code


Solution

  • This means the mediapipe library is not installed in your system and cvzone.PoseModule is dependent of that module. after installing cvzone, you also have to install mediapipe library.

    pip install cvzone
    

    then:

    pip install mediapipe
    

    Then you can import the modules successfully.