ITADN

Document PyInstaller/macos packaging for MediaPipe Python Tasks apps

#6282Openjananadiw 创建于 2026-04-30
J
jananadiwcommented
### Description of issue (what needs changing) Missing deployment/packaging guidance for Python Tasks apps using PyInstaller on macOS. ### Clear description MediaPipe Python Tasks work well in development, but packaging a desktop app with PyInstaller on macOS requires several non-obvious steps that are not currently documented clearly. Ex: apps using Pose Landmarker may need guidance on: - bundling `.task` model files - resolving model paths inside a PyInstaller app bundle, such as using `sys._MEIPASS` - passing the resolved path to `python.BaseOptions(model_asset_path=...)` - including MediaPipe task/native modules, ex: hidden imports such as `mediapipe.tasks.c` - deciding whether to download models at runtime or ship them with the app - macOS camera permission behaviour for packaged `.app` builds versus running from Terminal/Python . I validated this with `mediapipe==0.10.35`. This is not a runtime bug report; it is a request for a short packaging/troubleshooting docs section or example for Python desktop apps. ### Correct links The existing Pose Landmarker Python guide is correct for development usage, but it does not cover PyInstaller/macOS packaging or model asset bundling. ### Parameters defined The API params appear to be documented. The missing detail is how `model_asset_path` should be handled when the `.task` model file is bundled inside a PyInstaller app. ### Returns defined No return-value (Doc) ### Raises listed and defined Runtime errors occur in packaged apps when model assets or native/task modules are not bundled correctly. ### Usage example - a `resource_path(relative_path)` helper that returns `os.path.join(sys._MEIPASS, relative_path)` when running from PyInstaller, otherwise returns the local path - `model_path = resource_path("pose_landmarker.task")` - `base_options = python.BaseOptions(model_asset_path=model_path)` - `options = vision.PoseLandmarkerOptions(base_options=base_options)` - `pose_landmarker = vision.PoseLandmarker.create_from_options(options)` The docs could pair this with a minimal PyInstaller command, for example: `pyinstaller app.py --add-data "pose_landmarker.task:." --collect-all mediapipe --hidden-import mediapipe.tasks.c` ### Request visuals, if applicable _No response_ ### Submit a pull request? Yes, I'd be interested in submitting a document PR, if maintainers agree this belongs in the MediaPipe Docs.
0 条评论