Registry / ai-ml / mediapipe

mediapipe

JSON →
library1.0.1pypypi✓ verified 24d ago

MediaPipe is an open-source framework from Google that provides cross-platform, customizable ML solutions for live and streaming media. It enables researchers and developers to build world-class machine learning applications for mobile, edge, cloud, and the web. The current version is 0.10.33, with frequent releases addressing bug fixes, performance improvements, and API enhancements.

pip install mediapipe
INSTALL
IMPORT
SIG · MEDIAPIPE
M
mediapipe
ai-mlpythonv1.0.1
Install
11.9s avg
Import
Disk
502MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 11.9s · import 0.000s · 494MB
502MB installed
● package 502MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mediapipe
import mediapipe as mp
tasks.python.vision
from mediapipe.tasks import python from mediapipe.tasks.python import vision
solutions
from mediapipe.solutions import ...
import mediapipe.solutions
The `mediapipe.solutions` module was removed in MediaPipe versions 0.10.30 and later. Users should migrate to the `mediapipe.tasks` API for pre-built ML models.

This quickstart demonstrates how to set up an object detector using the modern `mediapipe.tasks` API. It initializes an `ObjectDetector` with a placeholder model path and performs detection on a dummy image, printing any detected objects and their bounding boxes. Remember to replace the `model_path` with an actual downloaded MediaPipe `.task` model file, such as `efficientdet_lite0.tflite`.

import mediapipe as mp from mediapipe.tasks import python from mediapipe.tasks.python import vision import numpy as np import os # Placeholder for a real model file. Download a .task file (e.g., efficientdet_lite0.tflite) # from MediaPipe's model zoo (https://developers.google.com/mediapipe/solutions/object_detector) # or use your own. For local testing, ensure the file exists. # Example: model_path = '~/mediapipe_models/efficientdet_lite0.tflite' model_path = os.environ.get('MEDIAPIPE_MODEL_PATH', 'object_detector.tflite') # Replace with actual model path or env var try: # Create a BaseOptions object with the model asset path. # For GPU acceleration on supported platforms, add delegate=python.BaseOptions.Delegate.GPU base_options = python.BaseOptions(model_asset_path=model_path) # Create an ObjectDetectorOptions object. options = vision.ObjectDetectorOptions(base_options=base_options, score_threshold=0.25, max_results=5) # Create an ObjectDetector. detector = vision.ObjectDetector.create_from_options(options) # Create a dummy image (e.g., a blank white image) for demonstration. # In a real application, you'd load an image from a file or camera. dummy_image_np = np.zeros((224, 224, 3), dtype=np.uint8) + 255 # White 224x224 image mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=dummy_image_np) # Perform object detection on the image. detection_result = detector.detect(mp_image) # Print the detection results. print("Detection results:") if detection_result.detections: for detection in detection_result.detections: for category in detection.categories: print(f" Category: {category.category_name}, Score: {category.score:.2f}") bbox = detection.bounding_box print(f" Bounding Box: (x:{bbox.origin_x}, y:{bbox.origin_y}, w:{bbox.width}, h:{bbox.height})") else: print(" No objects detected.") except FileNotFoundError: print(f"Error: Model file not found at '{model_path}'. Please ensure the model exists or update MEDIAPIPE_MODEL_PATH environment variable.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingThe `mediapipe.solutions` module has been removed in versions 0.10.30 and later. Code relying on this module will break.
fix
Migrate your code to use the `mediapipe.tasks` API, which provides a more unified and extensible way to access MediaPipe's pre-built ML models and custom graphs.
affects: >=0.10.30
gotchaOfficial PyPI packages for MediaPipe on Windows currently lack full GPU acceleration support, and OpenGL is automatically disabled for Windows builds. While you can specify `delegate=python.BaseOptions.Delegate.GPU`, it might not leverage the GPU and could fall back to CPU, or the feature might be unavailable.
fix
For optimal GPU performance on Windows, you might need to build MediaPipe from source with specific GPU configurations (e.g., CUDA-enabled OpenCV, TensorFlow GPU). Alternatively, consider using Linux environments or WSL for better GPU integration with MediaPipe.
affects: All versions on Windows via PyPI
gotchaMediaPipe often provides precompiled Python wheels for specific Python versions. Installing with very new Python versions (e.g., Python 3.13) might result in 'No matching distribution found' errors due to lack of compatible wheels.
fix
If you encounter installation issues, try downgrading your Python interpreter to a version officially supported by the latest MediaPipe release (e.g., Python 3.10-3.12). Check the PyPI page for available wheels.
affects: Potentially newer Python versions (e.g., Python 3.13+)
breakingSignificant internal refactoring and migration to 'API3' has been an ongoing effort across several recent versions. While primarily affecting C++ users building custom calculators, advanced Python users interacting with lower-level framework components or custom graphs might need to adjust their code.
fix
For basic usage with `mediapipe.tasks`, this is generally handled internally. For custom solutions or graphs, consult the official MediaPipe documentation for API3 migration guides and examples.
affects: >=0.10.25 (gradual changes)
gotchaWindows users, especially with newer MediaPipe versions, sometimes encounter `Import Error: DLL load failed while importing _framework_bindings`.
fix
This issue can often be resolved by ensuring that Visual C++ Redistributable packages are installed on your system. Sometimes, explicitly installing `msvc-runtime` (`pip install msvc-runtime`) can also help, although this is more of a workaround for specific environments.
affects: Some recent versions on Windows
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mediapipe'
The mediapipe package is not installed in the Python environment being used, or there's a typo in the import statement.
fix
Ensure MediaPipe is installed by running `pip install mediapipe` (or `pip3 install mediapipe`) in your terminal, and confirm you are using the correct Python environment.
AttributeError: module 'mediapipe' has no attribute 'solutions'
This error often occurs because the `mediapipe.solutions` module has been deprecated or significantly changed in newer versions of MediaPipe (post-0.10.x), requiring migration to the new `mediapipe.tasks` API.
fix
Update your code to use the `mediapipe.tasks` API (e.g., `from mediapipe.tasks import python`) or downgrade MediaPipe to a version that supported `mediapipe.solutions`, such as `pip install mediapipe==0.10.14`.
ERROR: Could not find a version that satisfies the requirement mediapipe
This typically indicates that the installed Python version is not officially supported by the available MediaPipe wheels on PyPI, or there are network/proxy issues preventing pip from fetching the package.
fix
Ensure you are using a Python version (e.g., 3.7-3.11) officially supported by MediaPipe, upgrade pip (`python -m pip install --upgrade pip`), and consider using a virtual environment.
ERROR: Unable to read from webcam. Please verify your webcam settings.
The application cannot access the webcam due to incorrect camera ID, insufficient permissions, the camera being used by another application, or outdated/missing drivers.
fix
Verify the camera ID (usually 0 for the default webcam), close other applications that might be using the camera, check system privacy settings for camera access, and ensure your webcam drivers are up to date.
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
This error points to a binary incompatibility between your installed MediaPipe and NumPy versions, often due to a mismatch where NumPy is either too new or too old for the MediaPipe installation.
fix
Downgrade or upgrade NumPy to a version compatible with your MediaPipe installation, for instance, `pip install numpy==1.23.0` or `pip install numpy==1.24.4`, and re-install MediaPipe if necessary.
Upgrade
Version history
1.0.1latest on PyPI · released Aug 14, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
204 hits · last 30 days
node
196
OpenAI (training)
1
Resources