-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
opencv-headless requirement breaks existing installation #351
Comments
Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap. |
@adrianboguszewski for workaround you can delete headless and reinstall full and use with full version and that would work. I can make them explicitly separated and ask install one of them but if you just install supervision it won't have any opencv so we can change our install to force either let's say "headless" and "full" like "pip install supervision[full]" but If you also try to install headless it will skip supervision but install headless in the of the day. So in the end of the day user also has to choose one of them and make sure not have both or delete one them. |
Yeah, that's what I did as a workaround. But also, I'm thinking about the mature solution. I don't know if there is any way to check opencv has been already installed so more research is needed. I think your proposition isn't bad. Let's say the default version is headless and if the user wants to have full opencv they must go with pip install supervision[full] |
That is the default right now. But problem is full bring headless too. |
Also related : python-poetry/poetry#6419 and not exist yet. So most possible option I see separate both and install one but user has to delete if there is both and we need to as a warning sign as well. |
@SkalskiP I know how we do it. So I think we should document at least for conflict problem between headless and full and maybe we can reconsider separate but warning is clear (just install "pip install supervision" won't be enough anymore. |
@hardikdava could you please put your input as well ? I am thinking about 2 ways but I wanna talk through as well. |
@onuralpszr I would suggest to do as following:
Main reason is that most of the uses uses supervision for dataset conversion and annotators which requires GUI (from normal opencv package). |
that is the current but problem is they need to delete headless opencv if they started like that* |
The thing is that's not possible when using Poetry instead of pip:
When using Poetry the workaround is to uninstall opencv-python-headless after installing supervision using pip... wich will "fix" the problem but totally not a good solution.
|
@onuralpszr is that problem still active? |
yes. Someoneelse is encountering the same issue? |
Quick workaround pip install supervision
pip uninstall opencv-python-headless
pip install opencv-python
This should work. You uninstall headless and install full one and you can make it work. Make sure you delete headless and install opencv-python, If somehow you have both installed then delete both and install "opencv-python" should work. Let me know how is it go. |
Hi @onuralpszr 👋🏻 Do we have any ideas on how to improve |
@SkalskiP hello 👋 2 suggestions, I will explicit documentation how to manage properly those cases and not do change on toml, second I will remove headless and put desktop package and I will wrote documentation again to how to switch between them and explain how to manage desktop and headless, based on these I can create pr and we can put marl as complete? |
Sounds good. Would you like to work on this PR? |
Sure let me write based on option one then ? |
Hello, has there been any update on this? I'm trying to use opencv functions alongside the supervision but that's impossible because headless opencv is overwriting cv2 functions. For example, I can't run
|
We'll look into it this release. It's about time we fixed it. |
#1530 merged and close as complete |
The issue is fixed on development branch. You can install it with This will be added to the main package in the next release, at around 4th of October. |
So about that, while on a pre existing environment that I was using, (ultralytics docker image), installing supervision on that docker image makes opencv break again, (circular import errors) and cv2.HERSHEY etc. I dealt with this a few months ago as well, the best solution was to install supervision without any extra dependencies, Edit: I forgot to mention that I have been testing this with 0.24( the latest version released) |
Thank you @Kutayykilic ! |
Search before asking
Bug
Supervision >= 0.12.0 requires opencv-headless. If I use opencv-python in my application and then install supervision, my opencv is broken (overwritten by the headless package).
It would be nice to configure it somehow not to install opencv-headless if any opencv package already installed.
Environment
This happens for supervision >= 0.12.0
Ubuntu 22.04
Python 3.10
Minimal Reproducible Example
pip install opencv-python
pip install supervision==0.14.0
import cv2
import numpy as np
arr = np.zeros((10, 10), dtype=np.uint8)
cv2.imshow("img", arr)
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: