I am trying to follow the getting started guide for the hand landmarks in mediapipe for python but when I try to run it I get a runtime error.
Traceback (most recent call last):
File "C:\Users\Tom\PycharmProjects\MediaPipe\mediapipe_static.py", line 12, in <module>
with HandLandmarker.create_from_options(options) as landmarker:
File "C:\Users\Tom\PycharmProjects\MediaPipe\venv\lib\site-packages\mediapipe\tasks\python\vision\hand_landmarker.py", line 271, in create_from_options
return cls(
File "C:\Users\Tom\PycharmProjects\MediaPipe\venv\lib\site-packages\mediapipe\tasks\python\vision\core\base_vision_task_api.py", line 66, in __init__
self._runner = _TaskRunner.create(graph_config, packet_callback)
RuntimeError: Unable to initialize runfiles: ERROR: external/bazel_tools/tools/cpp/runfiles/runfiles.cc(120): cannot find runfiles (argv0="")
I am running on:
- python 3.10.8
- pip 23.0.1
- mediapipe 0.9.2.1
This is the code I ran
import mediapipe as mp
BaseOptions = mp.tasks.BaseOptions
HandLandmarker = mp.tasks.vision.HandLandmarker
HandLandmarkerOptions = mp.tasks.vision.HandLandmarkerOptions
VisionRunningMode = mp.tasks.vision.RunningMode
# Create a hand landmarker instance with the image mode:
options = HandLandmarkerOptions(
base_options=BaseOptions(model_asset_path='[path to hand_landmark.task]'),
running_mode=VisionRunningMode.IMAGE)
with HandLandmarker.create_from_options(options) as landmarker:
# Load the input image from an image file.
...
I tried changing the model_asset_path but this seemed to not be the issue here.