-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working on Windows 11: mediapipe version 0.10.18 and 0.10.20 #5838
Comments
Hi @creativival, We attempted to reproduce the issue by installing MediaPipe versions 0.10.14, 0.10.18, and 0.10.20 on Windows 11 with Python 3.12.8. While the installation was successful, we encountered the same error as you when attempting to import MediaPipe. However, after installing msvc-runtime using ![]() ![]() Could you please try installing msvc-runtime and check if the issue is resolved? If the problem persists, kindly provide the complete error logs along with your Windows version details. Thank you!! |
Hi @kuaashish Thanks for your reply. As you said, “import mediapipe” is possible in the latest version (0.10.20), but the following Pose Landmarks sample code gives an error “Import Error: DLL load failed while importing _framework_bindings". It worked fine in the older version (0.10.14). Please try the following code with “image.jpg” and “pose_landmarker.task” in the same directory. I installed the following libraries: "pip install mediapipe opencv-python msvc-runtime" My environment: Windows 11 Pro 23H2 + Python 3.12.8 (Official) + VS Code Thank you!! Sample code is a modified version of the official python sample code for colab to work locally. import mediapipe as mp
from mediapipe.tasks import python
from mediapipe.tasks.python import vision
from mediapipe.framework.formats import landmark_pb2
import numpy as np
import cv2
def draw_landmarks_on_image(rgb_image, detection_result):
# RGB → BGRに変換
bgr_image = cv2.cvtColor(rgb_image, cv2.COLOR_RGB2BGR)
annotated_image = np.copy(bgr_image)
pose_landmarks_list = detection_result.pose_landmarks
# Loop through the detected poses to visualize.
for idx in range(len(pose_landmarks_list)):
pose_landmarks = pose_landmarks_list[idx]
# Draw the pose landmarks.
pose_landmarks_proto = landmark_pb2.NormalizedLandmarkList()
pose_landmarks_proto.landmark.extend([
landmark_pb2.NormalizedLandmark(x=landmark.x, y=landmark.y, z=landmark.z) for landmark in pose_landmarks
])
mp.solutions.drawing_utils.draw_landmarks(
annotated_image,
pose_landmarks_proto,
mp.solutions.pose.POSE_CONNECTIONS,
mp.solutions.drawing_styles.get_default_pose_landmarks_style())
# BGR → RGBに変換
annotated_image_rgb = cv2.cvtColor(annotated_image, cv2.COLOR_BGR2RGB)
return annotated_image_rgb
# STEP 2: Create an PoseLandmarker object.
# base_options = python.BaseOptions(model_asset_path='pose_landmarker.task') # macOS
base_options = python.BaseOptions(model_asset_buffer=open('pose_landmarker.task', "rb").read()) # Windows
options = vision.PoseLandmarkerOptions(
base_options=base_options,
output_segmentation_masks=True)
detector = vision.PoseLandmarker.create_from_options(options)
# STEP 3: Load the input image.
image = mp.Image.create_from_file("image.jpg")
# STEP 4: Detect pose landmarks from the input image.
detection_result = detector.detect(image)
# STEP 5: Process the detection result. In this case, visualize it.
annotated_image = draw_landmarks_on_image(image.numpy_view(), detection_result)
cv2.imshow('', cv2.cvtColor(annotated_image, cv2.COLOR_RGB2BGR))
cv2.waitKey(0)
cv2.destroyAllWindows() |
Hi @creativival, Thank you for sharing the modified code. However, we are still unable to reproduce the issue. The sample code is working fine in my VS Code environment when using image.jpg and the task file in the same directory and this code.
As shown in the attached screenshot ![]() Could you try creating a new Python environment and reinstalling MediaPipe from scratch? Thank you!! |
Hi @kuaashish I found the cause of the bug. When reinstalling Windows 11, if I choose “Local reinstall”, I get the error “Import Error: DLL load failed while importing _framework_bindings” when I run the above Issue.py Another IsuueThere is another issue that may be related to this: the same error occurs in the import order with the Panda3D library. Steps to reproduceInstall the library with “pip install mediapipe panda3d”.
Error “Import Error: DLL load failed while importing _framework_bindings This occurs with “0.10.18” and “0.10.20” and not with “0.10.14”. Please verify. |
Hi @creativival, We have identified another issue and will bring it to our team's attention. However, if you previously had no issues importing MediaPipe and later imported other dependencies, you can avoid the error by using versions 0.10.18 or 0.10.20, as shown below. Thank you!! |
Hi @kuaashish For the time being, we will be using version 0.10.14. We will not be changing the order of loading the libraries at this time, as it would complicate the code. We hope that the _frame_work_bildings error will be resolved in the next version. Thank you for your response. We will now close the Issue. Bye!! |
We have reproduced the issue on our end, and it appears to be specific to Windows. The issue does not occur on macOS or Linux. When importing one of the Pandas3D libraries first, followed by MediaPipe (version 0.10.20), the issue arises (as shown in the attached screenshot). However, everything works fine in version 0.10.14. Importing MediaPipe first resolves the issue in 0.10.20, but due to the complexity of our code structure, reordering imports is not a feasible solution. Could you review this issue and check if a fix is possible? Thank you!! |
I have experimented with pip installation of MediaPipe to Windows 11.
Now, when I upgrade MediaPipe, I get the same error.
Based on the above verification, the new version cannot be launched on Windows 11.
In addition, the same problem occurs after installing the Visual C++ redistributable package.
Has anyone successfully installed and launched in a Windows 11 environment? Please let me know if there is a workaround.
The text was updated successfully, but these errors were encountered: