mediapipe
mediapipe copied to clipboard
Why mediapipe v0.10.15 depends on numpy (<2) and v0.10.14 doesn't?
My code is working fine with MP v0.10.14 and numpy v2.0.2. I can't update to numpy v2.1.1 yet because I use numba, whose v0.60.0, is not yet updated for latest numpy.
Anyway, when I was trying to update to latest MP, I got this warning.
Because mediapipe (0.10.15) depends on numpy (<2)
Was this pinning introduced on purpose to address some particular issue?
Hello @alanwilter The Numpy version was downgraded to <2 in this commit. This was done for the stability of the package across all platform architectures. With newer features coming to MediaPipe, we internally encountered issues packet propagation in MP graph with numpy 2.0.2 and hence downgrade was required.
Many thanks for that. Do you have an idea when numpy 2.1.x will be supported?
@alanwilter This will depend on factors like the dependent packages used in MediaPipe(similar to numba package in your project), the stability(as we have already encountered), the performance and acceptable accuracy for each of the supported tasks.
Hence, we cannot comment on the timeline for the time being.
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
How can we prevent this ticket to be automatically closed by the the GitHub Bot?
Hi @alanwilter,
This can be marked as a feature request for supporting NumPy versions>2. We will share it with the team, and based on future demand and discussions, we may proceed with implementation if everything aligns on our end.
Thank you!!
Hi, numba 0.61 was released recently. But I am still stuck with mediapipe 0.10.14. Is there a way I can help mediapipe to be compatible with numpy 2.x?
I would like to bump up this issue, mediapipe is beginning to be the only package that is not supporting it in the ML industry. Is there any progress, please, @kuaashish?
Is there any update on this? Now a couple months later, are there any issues with numpy 2 support in mediapipe?
@kuaashish @schmidt-sebastian @ayushgdev hoping someone can provide some info on this. We're currently having to work around this with pip tricks and it'd be good to know if there are still issues with packet propagation in MP graph, or any other issues with numpy 2?
i manually manage my package library so i have installed numpy<2 entirely manually and changed all of mediapipe's import statements accordingly. i didn't think too much about it but a lot of people are having issues, for me right now even more when im working with a few other people on a project. hope this dependency issue gets resolved soon
Anyone working on this yet? Numpy 2.2.6 compatibility would be really helpful.
A workaround would be to use uv which supports global overrides for dependencies:
dependencies = [
"mediapipe"
]
[tool.uv]
override-dependencies = [
"numpy>2"
]
However, this is not a feasible solution since a lot of the Python environment still relies on pip and wheels. That's why I created a simple script to download all MediaPipe wheels, remove the numpy<2 constraint, and rename the package to avoid conflicts in pip repositories.
You can find it here, with pre-built binaries already available in the releases: https://github.com/cansik/mediapipe-numpy2
I haven't pushed it to PyPI (yet), as I don't want to maintain an altered version of MediaPipe again...
@ayushgdev & @kuaashish Any updates on the progress, or at least a "we're working on it"? This is quite a blocker for libraries that depend on MediaPipe.
Update: The package is released on pypi mediapype-numpy2:
pip install mediapipe-numpy2
Unfortunately the outdated numpy v1 dependency caused so many conflicts when trying to use mediapipe in existing code bases that I ended up having to refactor it out into an external executable in order to access it via out of process calls (e.g uv run script.py). Not a fan of the pkg bloat and perf hit but IMHO was the only workable solution after wasting so much time dealing with broken dependencies.
I'd love to replace this hacky workaround if anyone knows of an alternative audio classification python package for audio labeling?
Quick update to my previous post:
The numpy2 compatible package is released now on pypi mediapype-numpy2:
pip install mediapipe-numpy2
@cansik You're a hero.
Could we make numpy<2 optional? It seems that many people are having success with numpy>=2. If someone has an issue with numpy>=2, they could add numpy<2 to their dependencies.
Thank you Cansik, for making the numpy2 modification :)
If I want to test the examples for raspberry pi https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/face_landmarker/raspberry_pi
Is it mandatory to build the wheels with: https://ai.google.dev/edge/mediapipe/solutions/build_python