Issue with mediapipe module not found · Issue #71 · cvzone/cvzone · GitHub
Skip to content

Issue with mediapipe module not found #71

Open

Description

@zeesh1979

Hi,
I am running the handtracker code you put in the lesson but i am getting below error:

Traceback (most recent call last):
File "E:/Alqadib/VirtuaLab/comp vision/main.py", line 1, in
from cvzone.HandTrackingModule import HandDetector
File "C:\Users\zeesh\AppData\Local\Programs\Python\Python39\lib\site-packages\cvzone\HandTrackingModule.py", line 10, in
import mediapipe as mp
ModuleNotFoundError: No module named 'mediapipe'

below is the code in case you wanna see, even tgough i installed it using: pip3 install mediapipe --user

`from cvzone.HandTrackingModule import HandDetector
import cv2
import socket

cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
success, img = cap.read()
h, w, _ = img.shape
detector = HandDetector(detectionCon=0.8, maxHands=2)

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
serverAddressPort = ("127.0.0.1", 5052)

while True:
# Get image frame
success, img = cap.read()
# Find the hand and its landmarks
hands, img = detector.findHands(img) # with draw
# hands = detector.findHands(img, draw=False) # without draw
data = []

if hands:
    # Hand 1
    hand = hands[0]
    lmList = hand["lmList"]  # List of 21 Landmark points
    for lm in lmList:
        data.extend([lm[0], h - lm[1], lm[2]])

    sock.sendto(str.encode(str(data)), serverAddressPort)

# Display
cv2.imshow("Image", img)
cv2.waitKey(1)

`

Activity

  1. iburakov commented on Mar 10, 2024

    @iburakov

    It seems that this package doesn't list mediapipe in its dependencies, so you have to pip install mediapipe manually, right.

    If you're still getting the ModuleImportError, as you wrote, check if you're using pip from the correct interpreter when installing mediapipe with pip -V (see the "from" part of the output).

    Relevant: https://stackoverflow.com/questions/78135691/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions