Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'mediapipe.python.solutions.hands' has no attribute 'hands' #5410

Closed
c61221 opened this issue May 16, 2024 · 5 comments
Assignees
Labels
legacy:hands Hand tracking/gestures/etc platform:python MediaPipe Python issues stale stat:awaiting response Waiting for user response type:support General questions

Comments

@c61221
Copy link

c61221 commented May 16, 2024

I had using Spider to write python program

Has anyone had this error when importing the mediapipe library? AttributeError: partially initialized module 'mediapipe' has no attribute 'hands'

Standalone code/steps you may have used to try to get what you need###

import cv2
import mediapipe as mp
cap = cv2.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.hands()
while True:
ret, img = cap.read()
if ret:
imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
results = hands.process(imgRGB)
print(results.mulit_hand_landmarks)
cv2.imshow('img', img)
if cv2.waitKey(10) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()


@c61221
Copy link
Author

c61221 commented May 16, 2024

software version
Python 3.11.9、Spyder 5.5.4
Windows 10

@kuaashish
Copy link
Collaborator

Hi @c61221,

After reviewing the code snippet you provided, it appears that you are using an legacy version of MediaPipe Hand Solution. We have recently launched enhanced MediaPipe Tasks APIs, which provide increased stability and functionality compared to the legacy version, and for legacy hand solution support has been completely ended.

We strongly advise migrating to these updated APIs for Hand landmarks, as we no longer support legacy solutions. You can find the documentation for the Hand Landmarker here and implementation guide for Python here.

Unfortunately, aside from this, we won't be able to assist you much further.

Thank you!!

@kuaashish kuaashish self-assigned this May 16, 2024
@kuaashish kuaashish added legacy:hands Hand tracking/gestures/etc platform:python MediaPipe Python issues type:support General questions stat:awaiting response Waiting for user response labels May 16, 2024
Copy link

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label May 24, 2024
Copy link

This issue was closed due to lack of activity after being marked stale for past 7 days.

Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy:hands Hand tracking/gestures/etc platform:python MediaPipe Python issues stale stat:awaiting response Waiting for user response type:support General questions
Projects
None yet
Development

No branches or pull requests

2 participants