[Python] Trouble importing mediapipe (Ubuntu 24.04.2 LTS)

Discussão em 'Python' iniciado por Stack, Março 11, 2025.

  1. Stack

    Stack Membro Participativo

    I followed the official Google tutorial to install MediaPipe:
    MediaPipe Installation Guide

    The installation seems successful, and I can run the test script without issues, getting the following output:

    I0000 00:00:1741695160.632977 70976 hello_world.cc:58] Hello World!
    I0000 00:00:1741695160.633054 70976 hello_world.cc:58] Hello World!
    ...


    However, when I try to import MediaPipe in my own Python script, I get the following error in VSCode (Pylance):

    Import "mediapipe" could not be resolved Pylance(reportMissingImports)


    Here’s an excerpt from my script:

    import cv2
    import mediapipe as mp

    mp_holistic = mp.solutions.holistic
    mp_drawing = mp.solutions.drawing_utils


    I am using Ubuntu 24.04.2 LTS and VSCode with Pylance.

    I already tried the following:

    • Checking if mediapipe is installed using pip show mediapipe, but it says Package(s) not found.
    • Running my script outside VSCode (python my_script.py), but the error persists.
    • Uninstall and install mediapipe again.

    Has anyone encountered this issue before? How can I resolve it?

    Thanks in advance for your help!

    Continue reading...

Compartilhe esta Página