rf-mediapipe - fork of mediapipe-numpy2
A patching tool to remove the numpy<2 constraint from
official mediapipe wheels.
The official mediapipe Python wheels published on PyPI include a strict dependency:
Requires-Dist: numpy<2
This prevents installation or use of mediapipe with numpy version 2 or higher. This constraint is problematic for users and downstream projects who want to use the latest numpy (see mediapipe issue #5612). As of now, a lot of mediapipe seems to work with numpy 2.x, but the PyPI wheels block installation.
This repository provides a script (patch_wheels.sh) that:
- Downloads all official mediapipe wheels for a given version from PyPI.
- Removes the
numpy<2requirement from the wheel metadata. - Renames the package to
mediapipe-numpy2to avoid conflicts with the official package. - Updates the wheel metadata to reference this repository.
- Rebuilds and outputs patched wheels that can be installed alongside
numpy>=2.
To use mediapipe with numpy>=2, install the pre-patched wheels from the releases as a drop-in replacement:
pip install mediapipe-numpy2Then import mediapipe as you normally would:
import mediapipe as mp-
Clone this repository:
git clone https://github.com/roboflow/mediapipe-numpy2.git cd mediapipe-numpy2 -
Run the patching script:
./patch_wheels.sh
By default, this will:
- Download the latest mediapipe wheels into
./downloaded_wheels - Output patched wheels into
./patched_wheels
You can override the mediapipe version and directories using environment variables:
VERSION=0.10.21 DOWNLOAD_DIR=./my_dl OUTPUT_DIR=./my_patched ./patch_wheels.sh
- Download the latest mediapipe wheels into
-
Install a patched wheel:
pip install ./patched_wheels/rf_mediapipe-*.whl
- The patched wheels are named
rf_mediapipeto avoid clashing with the official package. - This repository is not affiliated with the official mediapipe project.
- Use at your own risk; always test compatibility with your workflow.