-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Explicit OpenCV flavor requirement conflicts with existing installs of OpenCV #473
Comments
Here's another interesting edge case to keep in mind: user@xavier-001:~$ python3 -c "import cv2; print(cv2.__version__)"
3.3.1 However, trying to pip3 install imgaug gives this error: ERROR: Could not find a version that satisfies the requirement opencv-python-headless (from imgaug) (from versions: none)
ERROR: No matching distribution found for opencv-python-headless (from imgaug) The workaround I used to install imgaug is as follows: |
There is now a new release online in which This change does not fix the issue that I'm rather reluctant currently to remove opencv from the dependencies list. For professional users that would probably be the most convenient choice. I suspect however that the majority of all users is rather inexperienced and would encounter problems if the library did not fully install itself, even if there was a seemingly clear error message. There is also the issue that removing the opencv dependency would probably break many existing builds that rely on opencv being auto-installed via |
I support an approach that helps inexperienced users. Experienced users can typically find workarounds like those suggested in this thread. I do wonder under what circumstances a user would rely on |
As far as I can tell, the modification to Specifically, if I run
I couldn't find a way list alternative dependencies in a wheel, and it appears the idea was considered and rejected in PEP 426. |
Doesn't a virtual env resolve the issue? |
No, this doesn't give us a way to |
I have also encountered this issue where we are trying to break the dependency on I'm no Python packaging expert, but It seems like the wheel was made in an environment where |
Same issue here - @aleju what can be done about this? |
Does anyone know if pyproject.toml (replacing setup.py) could help us, or is this really a wheel-building issue? |
I second that. As a workaround (besides holding at
...or in a # ... other deps
imgaug --no-binary imgaug
# ... other deps And there is yet another option: I have created a pseudo-package re-branding I wonder, though, why the OpenCV Python bindings did not decide to solve the contrib and X11 options via the |
Just spent a whole morning getting bit by this. There should at least be a section in the README about how to install with different opencv flavors, and even better an officially supported way of making it happen. |
@aleju, I can also confirm that the uploaded wheel triggers the
Would that be feasible? |
|
Can you quickly elaborate what changed? |
IINM, that could be as simple as:
Anyone with the credentials for imgaug on PyPI could do that.
Yes, a true post-release according to PEP 440 (like |
On Windows, this creates another interesting error if you are trying to install ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: <REDACTED>\\.venv\\Lib\\site-packages\\cv2\\cv2.cp38-win_amd64.pyd'
Consider using the `--user` option or check the permissions. I worked around this using |
@patzm Could you, being German, try to write/call @aleju ? :) Here are his contact details: http://www.ajung.name/impressum.html |
It seems like @aleju stopped working on GitHub around June last year. If he doesn't intend to (exclusively) continue maintaining this repo, maybe someone can offer a helping hand 🤔. I opened #764 for that matter. Let's discuss over there. If Alex doesn't respond in say a month, I can for sure give him a call 😉. |
Yo apparently the recent release |
In some projects (e.g. paddleOCR), there is |
The current practice of specifying a requirement for
opencv-python-headless
causes conflicts for other installations of OpenCV. For example, if a user requires modules fromopencv-contrib-python
that are not available inopencv-python-headless
but they installimgaug
,pip
will install both versions and thusly have conflicting versions of OpenCV with different features. To do this, I have to do:It seems this problem was contemplated in #324 so I suppose I'm just here to confirm those fears are well-founded.
From what I can tell,
imgaug
supports any of the fouropencv-*-python-*
flavors. In light of that, I humbly propose the following as options (with a preference for the first):opencv-*-*
from theinstall_requires
insetup.py
. This is the simplest option and is compatible with the current installation instructions in the README which ask the user to install OpenCV on their own first. It is at this point that the user could choose the OpenCV flavor that makes sense for their application.scikit-image
seems to do and it may create problems for people who use package management systems likepipenv
orpoetry
where package installation sequence is ill-defined. It also will have sequencing issues for users who build their own customized versions ofopencv-python
in order to use non-free algorithms in OpenCV.I will gladly submit a PR for this if the relevant folks agree this is okay. Thanks!
The text was updated successfully, but these errors were encountered: