Build MediaPipe Python Wheel Package

This page describes how to build the MediaPipe Wheel Package. You can use the wheel package to install MediaPipe on your local UNIX machine or Raspberry Pi.

Prerequisites

To build the Python Wheel Package, your system requires the following:

  • Docker with Buildkit support (version 18 or higher)

The Python build pipeline has been tested with Python version 3.9, 3.10, 3.11 and 3.12.

Invoke BUILD using Docker

You can use one of the Docker images we published to the MediaPipe repository. We offer three different images:

  • manylinux_2_28_x86_64 contains the build pipeline to build Manylinux wheels, which can be run on any x86_64 unix host.

  • mp_manylinux_aarch64rp4 contains the build pipeline to build Raspberry Wheels with support for aarch64.

  • Dockerfile contains the build pipeline to build the C++ framework.

Manylinux image for x&6_64

Clone the MediaPipe repository and use the following commands to build the Docker image for most Unix platforms. You can modify the commands to build for any Python version that is pre-installed on the image (currently 3.9., 3.10, 3.11 and 3.12). For other Python versions, you can modify the Dockerfile accordingly.

Build the Docker image:

$ DOCKER_BUILDKIT=1 docker build -f Dockerfile.manylinux_2_28_x86_64 -t mp_manylinux . --build-arg "PYTHON_BIN=/opt/python/cp312-cp312/bin/python3.12"

Create the Docker container:

$ docker create -ti --name mp_pip_package_container mp_manylinux:latest

Copy the Docker container files to your local machine:

$ docker cp mp_pip_package_container:/wheelhouse/. wheelhouse/

Delete the Docker container:

$ docker rm -f mp_pip_package_container

Raspberry Pi image on ARM

Clone the MediaPipe repository and use the following commands to build the Docker image for Raspberry Pi platforms. The Dockerfile installs Python 3.12 from source and builds a wheel for only this version. For other Python versions, you can modify the Dockerfile accordingly.

Build the Docker image:

$ docker build -f Dockerfile.manylinux2014_aarch64rp4 -t mp_manylinux_aarch64rp4 .

Create the Docker container:

$ docker create -ti --name mp_pip_package_container mp_manylinux_aarch64rp4:latest

Copy the Docker container files to your local machine:

$ docker cp mp_pip_package_container:/wheelhouse/. wheelhouse/

Delete the Docker container:

$ docker rm -f mp_pip_package_container