This page shows you how to set up your development environment to use MediaPipe Tasks in your Python applications.
Supported platforms and versions
Building applications with MediaPipe Tasks requires the following development environment resources:
- OS:
- Desktop: Windows, Mac, Linux
- IoT: Raspberry OS 64-bit
- Python: version 3.9 - 3.12
- PIP: version 20.3+
Developer environment setup
Before running a MediaPipe task on a Python application, install the MediaPipe package.
$ python -m pip install mediapipe
After installing the package, import it into your development project.
import mediapipe as mp
MediaPipe Tasks dependencies
MediaPipe Tasks provides three prebuilt libraries for vision, text, audio. Depending on the MediaPipe Task used by the app, import the vision, text, or audio library into your development project.
Vision tasks
The MediaPipe Tasks vision module contains tasks that handle image or video inputs. To import the MediaPipe Tasks vision library, import the following dependency to your into your development project.
from mediapipe.tasks.python import vision
Text tasks
The MediaPipe Tasks text module contains tasks that handle string inputs.To import the MediaPipe Tasks text library, import the following dependency to your into your development project.
from mediapipe.tasks.python import text
Audio tasks
The MediaPipe Tasks audio module contains tasks that handle sound inputs. To import the MediaPipe Tasks audio library, import the following dependency to your into your development project.
from mediapipe.tasks.python import audio
BaseOptions configuration
The BaseOptions allow for general configuration of MediaPipe Task APIs.
Option name | Description | Accepted values |
---|---|---|
model_asset_buffer |
The model asset file contents. | Model content as a byte string |
model_asset_path |
The path of the model asset to open and map into memory. | File path as a string |
Troubleshooting
For help with technical questions related to MediaPipe, visit the discussion group or Stack Overflow for support from the community. To report bugs or make feature requests, file an issue on GitHub.
For help setting up your Python development environment, visit the Python developer's guide.