-
Notifications
You must be signed in to change notification settings - Fork 77
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
don't pip install opencv-python if opencv-contrib-python is installed #57
Comments
Humm.... DLL Hell approaching... Strange however, I just retested this example under windows (not from this repo), which use an Oil painting effect from opencv-contrib . So I would say it seems to kinda work on my computer. Anyway, this is probably due to a DLL clash. I solved this under macOS and linux by compiling a minimalist version of OpenCV and statically linking it inside imgui_bundle. Please try it also and tell me if it helps: demos/litgen/imgui_bundle/external/immvision/find_opencv.cmake:276 macro(immvision_find_opencv)
if (IMGUI_BUNDLE_IMMVISION_FETCH_OPENCV)
if (WIN32)
set(IMGUIBUNDLE_OPENCV_WIN_USE_OFFICIAL_PREBUILT_460 ON)
else()
set(IMGUIBUNDLE_OPENCV_FETCH_SOURCE ON)
endif()
endif() becomes: macro(immvision_find_opencv)
if (IMGUI_BUNDLE_IMMVISION_FETCH_OPENCV)
set(IMGUIBUNDLE_OPENCV_FETCH_SOURCE ON)
endif() This will result in pip fetching OpenCV from source and compiling it, then statically link it into imgui_bundle. |
... Fetching + compiling a minimalist OpenCV will add 3'30" to the pip build time |
Ok, two things:
So I guess the only solution is to remove opencv from the requirements (as far as i understood from reading the opencv contrib pipy page)
|
This is a bit akin dll hell indeed. SUPER nice example by the way, would be nice to include somewhere, maybe as a third demo? But yeah, fun new issue eh? So what happened exactly:
Solutions:
|
Ah, we're not the first to run into this: I think the solution they provide ("after install remove unused package variants") is not a good one because there will be plenty of packages listing imgui_bundle as a dependcy (mine's one) and at least some of those will also list opencv-contrib-python (again, mine). After just pip-installing such a package, the user will then have multiple opencv packages and need to do an uninstall. It also rather messes with my automated executable building as a github action. Your solution is better. Its apparently what is commonly done as well for packages depending on tensorflow Also relevant: https://discuss.python.org/t/conditional-package-install-depending-on-other-packages-in-environment/4140 |
I'll provide a PR |
I just pip-installed the current dev branch into the venv for my app. My app uses functionality from the opencv-contrib-python. After installing imgui_bundle, i now have both opencv-contrib-python and opencv-python installed, and trying to use functionality from the contrib version does not work.
In short, opencv-python should not be installed if opencv-contrib-python is already installed. I am not sure if there is a way to specify that with the dependency infrastructure (e.g. somehow to say that either of these is fine), but right now this messes with a perfectly fine set of pip packages ;)
The text was updated successfully, but these errors were encountered: