How to Install MediaPipe for Face and Hand Tracking (2026)

Quick answer

To install MediaPipe for face and hand tracking, create a virtual environment, upgrade pip, then install the Python package with python -m pip install mediapipe. Download the official face_landmarker.task and hand_landmarker.task model bundles, load each one with BaseOptions, and prove the install on one still photo before you open a camera. MediaPipe is Apache 2.0 licensed, so the software licence fee is $0. MediaPipe gives you ready-made face and hand landmarks on your own device; it does not identify who a person is, and it does not replace a trained custom detector.

Quick Answer

To install MediaPipe for face and hand tracking, create a virtual environment, upgrade pip, then install the Python package with python -m pip install mediapipe. Download the official face_landmarker.task and hand_landmarker.task model bundles, load each one with BaseOptions, and prove the install on one still photo before you open a camera. MediaPipe is Apache 2.0 licensed, so the software licence fee is $0. MediaPipe gives you ready-made face and hand landmarks on your own device; it does not identify who a person is, and it does not replace a trained custom detector.

In this article

  • How we checked this guide
  • Read this first: what MediaPipe is, licence, and project status
  • What MediaPipe replaces, and what it does not
  • How MediaPipe fits with OpenCV and other vision tools
  • Routes to install MediaPipe for face and hand tracking
  • Requirements before you install
  • Step 1: install MediaPipe for face and hand tracking
  • Step 2: download the face and hand model files
  • Step 3: run your first face test
  • Step 4: run your first hand test
  • Step 5: move to video and camera tracking
  • First-run security steps you must not skip
  • Backup and update routine
  • Common errors and fixes
  • Tips and tricks that save money
  • The real cost maths
  • When not to install MediaPipe for face and hand tracking
  • Pros and cons
  • Our verdict
  • FAQ
  • Strategic Pivot
  • Sources

How we checked this guide

We checked the official MediaPipe Python setup guide on December 5, 2026. That covers supported platforms, Python and pip versions, virtual-environment setup, and the vision task modules.

We also checked the official MediaPipe Tasks overview, the MediaPipe project licence information, and the Roboflow pricing page on December 5, 2026. Every Roboflow figure below comes from that official page.

Read this first: what MediaPipe is, licence, and project status

MediaPipe is Google’s open-source framework for running machine learning on the device in front of you. For this guide, the useful part is MediaPipe Tasks: prebuilt pipelines that take an image, a video frame, or a live camera stream and return structured results your code can use.

The vision tasks include Hand Landmarker, Face Landmarker, Pose Landmarker, Object Detector, and Image Segmenter. Face Landmarker finds face landmarks. Hand Landmarker finds hand landmarks. Your code then decides what those points mean: count raised fingers, follow a face for framing, drive a gesture control, or save review frames.

Do not treat MediaPipe like a finished business product. It is a toolkit your code calls, not a hosted dashboard. MediaPipe gives you the points. Your project still needs the rules, the interface, the privacy decision, and the review process.

MediaPipe is Apache 2.0 licensed. For a new install, the practical line is simple: the software licence fee is $0. Some models in the wider MediaPipe family carry their own terms, so keep the licence notices with any product you redistribute and check the model terms before you ship.

MediaPipe Python setup guide to install MediaPipe for face and hand tracking

What MediaPipe replaces, and what it does not

MediaPipe replaces the hardest first draft of face and hand tracking. Without it, a small team must find a model, wire up preprocessing, handle coordinates, and maintain the pipeline. With MediaPipe, you install one package, load one task file, and read landmarks.

MediaPipe is best when the job is tracking, not naming. Track a hand to control a slideshow. Track a face to keep a speaker framed. Count fingers for a simple kiosk interaction. Save hand positions for a training video review. Those jobs need points, not identities.

MediaPipe does not identify a person. Landmarks describe where eyes, lips, fingers, and joints sit in a frame. They do not tell you a customer’s name, and they should not be presented as recognition or security proof. If your real job is identifying people, you need a different product, a lawful basis, and a much stricter review.

MediaPipe also does not replace a trained object detector for your own products. If the job is finding your boxes, bottles, or defects in messy photos, use our YOLO guide. If the job is handling images and video frames before a model sees them, use our OpenCV guide. MediaPipe sits between them: OpenCV can prepare the frame, MediaPipe tracks the face or hand, and your rules make the decision.

How MediaPipe fits with OpenCV and other vision tools

Think of a tracking project as three layers. OpenCV opens the camera, reads frames, resizes them, and saves review images. MediaPipe reads a prepared frame and returns face or hand landmarks. Your code turns landmarks into an action: move a cursor, change a slide, blur a region, or flag a frame for review.

That division saves money. Many tracking demos fail because the input is messy: mirrored camera views, oversized frames, bad colour order, or a camera that never released. Fix the frame first, then judge the tracking.

MediaPipe Tasks accepts image, video, and livestream inputs. The official setup guide points Python users to mp.Image inputs built from files and OpenCV frames. Start with a file. A still photo is repeatable. A live camera adds permission, lighting, motion, and timing problems all at once.

Our Segment Anything Model guide covers the neighbouring case where a point or box becomes a precise mask. A practical workflow might use OpenCV to crop a frame, MediaPipe to track a hand, and a segmentation step only when the exact outline matters. Each tool stays on the job it does best.

Routes to install MediaPipe for face and hand tracking

RouteBest forSkip ifWhat you use
Python mediapipe package from PyPIDesktop, server, and notebook tracking in PythonYour product is a phone app with no Python layerpython -m pip install mediapipe in a virtual environment
Face Landmarker taskFace framing, expression-aware effects, and face landmark reviewYou need to identify who the person isface_landmarker.task loaded with BaseOptions
Hand Landmarker taskGesture control, finger counting, and hand position reviewYour scene needs whole-body pose firsthand_landmarker.task loaded with BaseOptions
Web, Android, iOS, or Flutter TasksBrowser and mobile products that track on deviceYou are prototyping in Python firstThe matching MediaPipe Tasks package for that platform
Hosted vision platformTeams that want labelling, training, deployment, and support togetherYour job is ready-made face or hand landmarks on hardware you ownA paid platform such as Roboflow, priced below

Python is the right default for this guide. The official setup guide uses a virtual environment, upgrades pip, installs mediapipe, then imports mediapipe.tasks.python.vision for vision tasks.

Choose the task file before you write tracking logic. Face and hand tracking are separate tasks with separate model bundles. Installing the package alone does not finish the job; your code must load the model file for the task you run.

Requirements before you install

You need Python 3.9 or later, in the 3.9 to 3.14 range, and pip 20.3 or newer. The official setup guide lists Windows x86_64 and arm64, macOS Apple Silicon, Linux x86_64 and aarch64 with glibc 2.28 or newer, and Raspberry Pi 5 or newer running 64-bit Raspberry Pi OS.

Create a virtual environment first. Tracking projects mix OpenCV, NumPy, and model files, and a clean environment makes failures readable. Upgrade pip before you debug MediaPipe.

For camera work, prove the camera in the operating system first. MediaPipe cannot fix a permission block, a busy camera, or a broken driver. For still-photo tests, use one clear face photo and one clear hand photo with good light.

Step 1: install MediaPipe for face and hand tracking

Create a virtual environment in your project folder. The official guide names it mp_env. On Windows, activate it with the Windows path shown in the guide.

MediaPipe Tasks overview to install MediaPipe for face and hand tracking
python3 -m venv mp_env
source mp_env/bin/activate
python -m pip install --upgrade pip
python -m pip install mediapipe

On Windows, run mp_env\Scripts\activate instead of the source line. Then prove the import before you download models:

import mediapipe as mp
from mediapipe.tasks import python
from mediapipe.tasks.python import vision

print("MediaPipe import OK")

If the import fails, fix the environment first. Confirm the virtual environment is active, confirm the IDE uses the same interpreter, and confirm your Python version sits in the supported range. Do not debug a camera while the import is broken.

Step 2: download the face and hand model files

Every vision task loads a model bundle. For this guide you need two files: face_landmarker.task for faces and hand_landmarker.task for hands. Download them from the official MediaPipe model pages and keep them beside your script or in a models folder your code can find.

In Python, pass the local file path through BaseOptions:

from mediapipe.tasks import python

base_options = python.BaseOptions(model_asset_path="hand_landmarker.task")

The setup guide also allows model_asset_buffer when your app loads model bytes in memory. For a first project, a local path is easier to debug because a missing file fails loudly.

Keep model files under version control or in your backup set. A script without its .task file is not a working project. When you package an app, include the model file in the bundle; the setup guide warns that PyInstaller does not include .task bundles automatically.

Step 3: run your first face test

Start with one still photo. Create the Face Landmarker from options, load the image as an mp.Image, run detection, and print how many faces came back.

MediaPipe Tasks agents page to install MediaPipe for face and hand tracking
import mediapipe as mp
from mediapipe.tasks import python
from mediapipe.tasks.python import vision

base_options = python.BaseOptions(model_asset_path="face_landmarker.task")
options = vision.FaceLandmarkerOptions(base_options=base_options)

with vision.FaceLandmarker.create_from_options(options) as landmarker:
    mp_image = mp.Image.create_from_file("face.jpg")
    result = landmarker.detect(mp_image)
    print("Faces found:", len(result.face_landmarks))

If the count is zero, change the photo before you change the code. Use a front-facing, well-lit face with no heavy shadow. If the count is one, draw or save the landmarks and inspect them. A number alone does not prove the points sit where you expect.

Set num_faces deliberately. The default looks for a limited number of faces, so a group photo needs a higher value. Raise it only when your scene needs it; every extra face is extra work and extra review.

Step 4: run your first hand test

Repeat the same pattern for hands. Create the Hand Landmarker, load one hand photo, and print the result count.

import mediapipe as mp
from mediapipe.tasks import python
from mediapipe.tasks.python import vision

base_options = python.BaseOptions(model_asset_path="hand_landmarker.task")
options = vision.HandLandmarkerOptions(base_options=base_options)

with vision.HandLandmarker.create_from_options(options) as landmarker:
    mp_image = mp.Image.create_from_file("hand.jpg")
    result = landmarker.detect(mp_image)
    print("Hands found:", len(result.hand_landmarks))

Use a photo where the whole hand is visible against a plain background. Fingers cut off by the frame edge, heavy motion blur, and gloves all make the first test harder than it needs to be.

Inspect the landmarks before you build gestures. A gesture rule built on uninspected points will fire at the wrong time. Save an annotated review image, check the fingertip points, and only then write the rule that counts fingers or detects a raised hand.

Step 5: move to video and camera tracking

Only after both still tests pass should you open a camera. MediaPipe Tasks supports image, video, and livestream running modes. Video and livestream modes need timestamps handled in order, so keep your first camera script small: read a frame, convert it, run the task, save one review frame, and stop.

Use OpenCV for the camera layer when your project already uses it. Our OpenCV guide covers VideoCapture, frame checks, and releasing the camera. Release the camera when the script ends, or the next run may find a busy device.

Test with ten real frames: clean, dark, blurry, partly hidden, hand absent, face turned away, and two people in frame. Record which frames pass. A tracking feature that works only on the demo photo is not ready for a customer.

First-run security steps you must not skip

MediaPipe runs on your device, so security is about packages, model files, cameras, and stored frames. Install mediapipe from PyPI and download .task files only from official MediaPipe model routes. Do not use a bundled installer from a download portal.

Decide camera privacy before the first frame: who may view the feed, whether frames are saved, how long they are kept, and whether faces may appear. Landmarks are less sensitive than raw video, but the camera still sees real people. Get consent where your setting requires it.

Treat uploaded photos and videos as untrusted input. Limit file sizes, decode them in a controlled environment, and never let a filename choose the output path. Keep any stream credentials in environment variables or a secrets store.

Backup and update routine

Back up the working combination, not only the script. Your backup set is the code, the pinned mediapipe version, the Python version, both .task model files, your test photos, the expected outputs, camera settings, and any gesture thresholds. That set lets you rebuild the same behaviour on a new machine.

Pin the package after the first good test. A requirements.txt line with the exact version is enough for a small project. The point is that “it worked in March” should be reproducible in June.

Update in a separate environment first. Install the newer version there, run the same face and hand test photos, and compare the outputs before you replace the working setup. Model bundles and task options can change enough to matter. Promote the update only when the test set still passes.

Common errors and fixes

ModuleNotFoundError: No module named 'mediapipe' usually means the package is not in the interpreter running the script. Confirm the virtual environment and the IDE interpreter match.

A missing model file error means model_asset_path points at a file that is not there. Check the filename, check the folder, and run the script from the directory you think you are in. Keep model files in one known folder.

Zero faces or zero hands on a good photo usually means the wrong task file, a poor photo, or a count setting that is too low. Confirm you loaded face_landmarker.task for faces and hand_landmarker.task for hands, then retest with a clear front-facing photo.

Camera failures usually sit below MediaPipe. Confirm the camera works in another app, close apps that may own it, check permission, and release the capture at the end of every run. Mirrored left-right results usually mean the camera preview is flipped; decide which orientation your rules expect and document it.

Tips and tricks that save money

Prove still photos before video. A photo test separates install problems from camera problems. That separation is worth money because it stops you debugging a driver when the real fault is a missing model file.

Keep frames small enough to process. Oversized frames cost time on every run. Resize to the size your task needs, keep the original for review, and measure before you buy faster hardware.

Save a review folder for uncertain frames. Frames with no detection, low light, heavy blur, or surprising landmarks deserve human eyes. That folder becomes your next test set and your honest record of where tracking breaks.

Use one task per job. Face Landmarker for faces, Hand Landmarker for hands, Pose Landmarker for bodies. Loading every task for every frame wastes time and muddies failures.

The real cost maths

MediaPipe costs $0 in licence fees under Apache 2.0. The real cost is the computer, camera, script time, review time, and any platform you add when ready-made landmarks are not enough.

On Roboflow’s official pricing page checked on December 5, 2026, the Free Tier is $0 with 10 credits a month, enough to train about 30 models or run 80,000 inferences. Core is $39 per month billed monthly, enough to train about 60 models or run 160,000 inferences. Prepaid credits start at $4 and expire after one year; on-demand credits cost $6 and require a linked card.

Roboflow official pricing page to install MediaPipe for face and hand tracking

Imagine a training studio adding gesture control to a kiosk it already owns. MediaPipe on the existing computer can track hands for $0 in licence fees. The break-even line against Roboflow Core is $39 a month, $468 a year, for setup, review, electricity, and upkeep.

If the job is tracking faces or hands with ready-made landmarks, MediaPipe wins. If the job is training a custom detector for your own objects, Roboflow’s $39 buys labelling, training, deployment, workflows, and support that a local toolkit does not provide.

When not to install MediaPipe for face and hand tracking

Do not install MediaPipe when nobody on the team can run a Python environment. The documented route is a virtual environment, a pip install, model files, and code that checks its own outputs. If that sentence already sounds like a support ticket, a hosted platform or a freelancer-built script is the honest choice.

Do not use landmarks as identity, attendance, or security proof. Landmarks track position. They do not prove who someone is, whether they consented, or whether a count is safe to bill on. Those jobs need measured accuracy, consent, and a review process.

Do not start with a live camera. A camera adds permission, lighting, motion, mirroring, and timing faults before you know whether the install works. Earn the camera step with two passing photo tests.

Do not choose MediaPipe alone when the real job is finding your own products. Use the detector guide when the judgement, not the tracking, is the hard part.

Pros and cons

Pros

  • $0 Apache 2.0 software licence fee
  • Official Python route with a short virtual-environment setup
  • Ready-made Face Landmarker and Hand Landmarker tasks
  • Runs on device, so private frames can stay on your machine
  • Supports image, video, and livestream inputs
  • Pairs well with OpenCV camera and frame handling
  • Works across desktop, server, notebook, and Raspberry Pi routes
  • No per-call tracking bill on the open-source route

Cons

  • It is a toolkit, not a finished dashboard or hosted service
  • Model .task files must be downloaded and shipped with your app
  • Python environment mistakes cause many first-day failures
  • Landmarks track position; they do not identify a person
  • Poor light, blur, and occlusion still break tracking
  • Gesture rules need your own thresholds and review
  • No vendor support desk on the open-source route
  • Accuracy still needs your test set and review process

Our verdict

Install MediaPipe for face and hand tracking when your real job is tracking faces or hands on hardware you control, with a team that can run Python. Start with a virtual environment, install mediapipe, load the face and hand task files, and prove both on still photos before you open a camera.

The maths favors MediaPipe for tracking work on a computer you already own: $0 in licence fees against $39 a month, $468 a year, for Roboflow Core billed monthly. The break-even line is $39 a month for setup, review, electricity, and upkeep. Choose the task file first. Move to video only after photo tests pass. Move to a hosted platform only when you need training, deployment, or support.

Choose Roboflow when you need labelling, training, hosted deployment, workflows, or support. Choose YOLO when the job is finding known objects in changing scenes. Choose MediaPipe when the job is face or hand landmarks, gesture input, framing, and honest tracking before a person or a rule decides.

Respect the limits either way. MediaPipe will return points for the frame you give it, including a bad frame. Prove it on your worst photos, keep originals untouched, record the settings, and let the workflow earn each session.

FAQ

Is MediaPipe free for a business?

MediaPipe is Apache 2.0 licensed, so the MediaPipe software licence fee is $0. Internal business use is straightforward. Some models in the wider family carry their own terms, so check the model terms and keep licence notices with any product you redistribute.

Do I need a GPU to install MediaPipe?

No. The Python setup route runs on supported desktop, server, notebook, and Raspberry Pi hardware without requiring a GPU purchase first. Start on the computer you own, prove the photo tests, and measure before you buy faster hardware.

Why does MediaPipe find zero faces or zero hands?

The usual causes are a missing or wrong .task file, a poor test photo, or a count setting that is too low for the scene. Confirm the model path, retest with a clear front-facing photo, and raise num_faces or the hand count only when your scene needs it.

Can MediaPipe identify who a person is?

No. Face Landmarker returns landmark positions, not identity. Do not present landmarks as recognition, attendance, or security proof. Identity jobs need a different product, a lawful basis, consent, and a stricter review process.

Is MediaPipe enough, or do I need YOLO or Roboflow?

MediaPipe is enough when the job is tracking faces or hands with ready-made landmarks. YOLO is the better tool when known objects must be found in changing scenes. Roboflow fits when you need labelling, training, hosted deployment, workflows, or support. Many projects combine them: OpenCV prepares frames, MediaPipe tracks people, and a detector handles products.

Strategic Pivot

Before you rent a vision platform for a hand-tracking kiosk, run your own numbers. Our free AI Cost Calculator turns a subscription price and your monthly volume into a break-even line you can defend. Two minutes there can show whether $39 a month is cheap, expensive, or irrelevant next to the computer already sitting in your office.

Sources

Price note — updated December 5, 2026: Prices in this post were checked on December 5, 2026. When you are reading this, the price may be lower or higher. Check the official pricing page before you buy.

Pros

  • $0 Apache 2.0 software licence fee
  • Official Python route with a short virtual-environment setup
  • Ready-made Face Landmarker and Hand Landmarker tasks
  • Runs on device, so private frames can stay on your machine
  • Supports image, video, and livestream inputs
  • Pairs well with OpenCV camera and frame handling
  • Works across desktop, server, notebook, and Raspberry Pi routes
  • No per-call tracking bill on the open-source route

Cons

  • It is a toolkit, not a finished dashboard or hosted service
  • Model .task files must be downloaded and shipped with your app
  • Python environment mistakes cause many first-day failures
  • Landmarks track position; they do not identify a person
  • Poor light, blur, and occlusion still break tracking
  • Gesture rules need your own thresholds and review
  • No vendor support desk on the open-source route
  • Accuracy still needs your test set and review process
Our verdict

Install MediaPipe for face and hand tracking when your real job is tracking faces or hands on hardware you control, with a team that can run Python. Start with a virtual environment, install mediapipe, load the face and hand task files, and prove both on still photos before you open a camera. The maths favors MediaPipe for tracking work on a computer you already own: $0 in licence fees against $39 a month, $468 a year, for Roboflow Core billed monthly. The break-even line is $39 a month for setup, review, electricity, and upkeep. Choose the task file first. Move to video only after photo tests pass. Move to a hosted platform only when you need training, deployment, or support. Choose Roboflow when you need labelling, training, hosted deployment, workflows, or support. Choose YOLO when the job is finding known objects in changing scenes. Choose MediaPipe when the job is face or hand landmarks, gesture input, framing, and honest tracking before a person or a rule decides. Respect the limits either way. MediaPipe will return points for the frame you give it, including a bad frame. Prove it on your worst photos, keep originals untouched, record the settings, and let the workflow earn each session.

Leave a Comment