mediapipe: AttributeError: module 'mediapipe' has no attribute 'solutions'

Has anyone had this error when importing the mediapipe library?

AttributeError: partially initialized module ‘mediapipe’ has no attribute ‘solutions’(most likely due to a circular import)

import cv2
import mediapipe as mp
mp_drawing = mp.solutions.drawing_utils
mp_face_mesh = mp.solutions.face_mesh

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 11
  • Comments: 38

Most upvoted comments

It turns out that as I am very smart, my file had the same name as the library, now that I change it, it works as it should

Just change your file name. Thanks .

May I ask which file I should change the name of? (Sorry if this has an obvious answer)

my file was named mediapipe.py, but that name is the same as the library, so I had to change the name to something else

Yes! Just change your folder’s name. Maybe you have a folder in your working directory which has the same like the dependency (mediapipe)

Le ven. 14 avr. 2023 à 16:43, StratosphericD @.***> a écrit :

Hi, Thank you for opening this issue.

Python 3.7.9 macOS 10.14.6

I ran into the same issue. Both #1466 https://github.com/google/mediapipe/issues/1466 and #1349 https://github.com/google/mediapipe/issues/1349 recommended to install using pip install mediapipe, but after trying with multiple python versions inside/outside different env it still failed with: ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none) ERROR: No matching distribution found for mediapipe

So I built the package from source successfully. But the same error was raised when running the sample code: AttributeError: module ‘mediapipe’ has no attribute ‘solutions’

Any suggestions would be appreciated!

Did you solve your problem? I am running into the same issue.

— Reply to this email directly, view it on GitHub https://github.com/google/mediapipe/issues/1928#issuecomment-1508822856, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASDIRWI7AADPG2UJ5RQRSLDXBFWB7ANCNFSM43NASG4A . You are receiving this because you commented.Message ID: @.***>

@DevanshYadav07 the main file, where you import mediapipe

May I ask which file I should change the name of? (Sorry if this has an obvious answer)

my file was named mediapipe.py, but that name is the same as the library, so I had to change the name to something else

It worked for me, thx

My file name is BalloonPwop.py, and same problem…

It turns out that as I am very smart, my file had the same name as the library, now that I change it, it works as it should

my file name was different, but I was getting this error again and again, then I figured out that in that directory I had a folder named mediapipe. I deleted it and the error resolved. so other than the file name be careful about any other file or folder with same name.