Skip to content

Python 3.13 Support: MediaPipe Fails to Build and No Wheels Available #6159

Description

@abhiikxiusongit

🚀 Overview

MediaPipe currently does not provide pre-built wheels for Python 3.13, and attempting to build from source results in multiple errors related to Bazel, pybind11, and ABI changes introduced in CPython 3.13.

I am trying to contribute and help make MediaPipe compatible with Python 3.13, but the build fails consistently on Windows 11.

This issue summarizes the exact environment, steps, errors, and possible fixes.


🖥️ Environment

  • OS: Windows 11 (64-bit)
  • Python Version: 3.13.5
  • MediaPipe Version: 0.10.x (latest main branch)
  • Bazel/Bazelisk Version: Latest (auto-managed by Bazelisk)
  • Compiler: MSVC (Build Tools for Visual Studio 2022)
  • CMake: Installed
  • pip packages: numpy, protobuf, opencv-python, pybind11 (latest)

📦 Steps to Reproduce

  1. Clone the repo:

    git clone https://github.com/google/mediapipe
    cd mediapipe
  2. Set Python 3.13 paths:

    set PYTHON_BIN_PATH=C:\Path\To\Python313\python.exe
    set PYTHON_LIB_PATH=C:\Path\To\Python313\Lib\site-packages
  3. Install dependencies:

    pip install --upgrade numpy protobuf opencv-python pybind11
  4. Run Bazel build:

    bazel build -c opt mediapipe/python:mediapipe

❌ Actual Behavior

Build fails with errors such as:

  • pybind11 internal API mismatch with CPython 3.13
  • ABI-breaking changes in Python header files
  • Bazel C++ toolchain incompatibility
  • Missing or incompatible build rules for Python 3.13

Since Python 3.13 made notable changes to the interpreter API, C-extension build failures are expected.

I can provide full logs if needed.


✔️ Expected Behavior

  • MediaPipe should compile successfully against Python 3.13
  • OR provide official wheels on PyPI (cp313)
  • OR provide guidance on required patches

🙋 Contribution Offer

I am actively trying to build a working wheel for Python 3.13 and am willing to:

  • Submit patches
  • Test builds
  • Help update Bazel rules
  • Help document Python 3.13 migration

Any guidance from maintainers about the correct approach would be extremely helpful.

I will also provide a GitHub repository containing:

  • Full build logs
  • Applied patches
  • Custom wheel
  • Demo script

📝 Additional Notes

Python 3.13 will become a widely adopted version soon, and MediaPipe is used heavily in academic and production contexts. Adding compatibility early will prevent user issues when 3.13 becomes default.

Thank you for considering this!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions