mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

import mediapipe error

Open grewe opened this issue 6 months ago • 1 comments

when import mediapipe get following error:

/usr/local/lib/python3.11/dist-packages/mediapipe/tasks/python/audio/init.py in 25 AudioEmbedderOptions = audio_embedder.AudioEmbedderOptions 26 AudioEmbedderResult = audio_embedder.AudioEmbedderResult ---> 27 RunningMode = core.audio_task_running_mode.AudioTaskRunningMode 28 29 # Remove unnecessary modules to avoid duplication in API docs.

NameError: name 'core' is not defined


Environment: Google Colab Python: 3.11


Code leading up to import mediapipe line:

!pip install numpy openai opencv-python mediapipe requests Pillow matplotlib !pip install transformers timm !pip install git+https://github.com/facebookresearch/segment-anything.git !pip install torch torchvision torchaudio

import requests import torch import cv2 import numpy as np import openai import mediapipe as mp import io import base64 from PIL import Image from segment_anything import sam_model_registry, SamAutomaticMaskGenerator from midas.transforms import Resize, NormalizeImage, PrepareForNet from scipy.spatial import ConvexHull from torchvision.transforms import Compose

=========================== NOTE:

For some reason, the install of mediapipe downgrades the version of both numpy and protobuf as as shown here in the output log info:

Installing collected packages: protobuf, numpy, sounddevice, mediapipe Attempting uninstall: protobuf Found existing installation: protobuf 5.29.2 Uninstalling protobuf-5.29.2: Successfully uninstalled protobuf-5.29.2 Attempting uninstall: numpy Found existing installation: numpy 2.1.0 Uninstalling numpy-2.1.0: Successfully uninstalled numpy-2.1.0 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. ydf 0.12.0 requires protobuf<6.0.0,>=5.29.1, but you have protobuf 4.25.8 which is incompatible. thinc 8.3.6 requires numpy<3.0.0,>=2.0.0, but you have numpy 1.26.4 which is incompatible. grpcio-status 1.71.0 requires protobuf<6.0dev,>=5.26.1, but you have protobuf 4.25.8 which is incompatible. Successfully installed mediapipe-0.10.21 numpy-1.26.4 protobuf-4.25.8 sounddevice-0.5.2

NOTE: I have read the online getting started documentation for python and have searched for solutions. I tried to first install different versions of numpy and protobuf to address issues but, it still has the same response.

grewe avatar Jun 03 '25 06:06 grewe

Hi @grewe,

We can reproduce this issue from our end. We anticipate it will be resolved once PR https://github.com/google-ai-edge/mediapipe/pull/5993 is merged.

Thank you!!

kuaashish avatar Jun 04 '25 10:06 kuaashish