Skip to content
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

Make opencv optional #2

Closed
wants to merge 1 commit into from

Conversation

Erotemic
Copy link
Member

Seeks to address #1 by making opencv-python optional
details about what the issue is are in: Kitware/nrtk#2

We want to make it such that the package can be used with either opencv-python xor opencv-python-headless, and we don't want pip to clobber an environment that depends on opencv-python-headless just because we pip install this package. The best solution I have so far is just make both optional and inform the user that they need to pick one if we try to use cv2 at runtime and it is not there.

@bjrichardwebster
Copy link
Contributor

PRs that end up on GitHub will have to get manually replicated into the primary repo this repo is mirrored from. I saw your PR/comment on this previously but haven't had a chance yet to move a solution into the primary repo. I have to confirm it complies with the program's SDP before proceeding.

I can't seem to find the original comment about why this is causing an issue, can you link it here again so I can take a look?

@Erotemic
Copy link
Member Author

I've written about the issue in several places. This one is a good summary: opencv/opencv-python#467

The essence is opencv-python and opencv-python-headless cannot be installed together, but both provide the cv2 module. Some libraries do not work with opencv-python and instead require opencv-python-headless, also vis-versa (for instance nrtk is currently a library that requires opencv-python, so it locks out being installed with any other package that requires opencv-python-headless).

This comment also gives another perspective on the issue: pypa/pip#10837 (comment)

Effectively, the solution to the problem is: don't depend on any opencv flavor in the top level requirements. Any dependency on opencv should be optional. If the main use-case of this tool requires the opencv-python flavor, then the official instruction change from pip install pyBSM to pip install pyBSM[cv2-graphics]. Likewise for any downstream program that wants to require opencv-python headless (which is my preference) the instructions become pip install pyBSM[cv2-headless]. Note: you can rename the cv2-graphics and cv2-headless tag whatever you want.

@bjrichardwebster
Copy link
Contributor

We're tracking this over in the primary gitlab instance now, I'll close these PRs once there is a solution that gets propagated.

@bjrichardwebster
Copy link
Contributor

bjrichardwebster commented Oct 1, 2024

The fix should be in now as of this commit, and was released in pybsm==0.7.0. Closing the PR, please re-open if the original issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants