Flexible requirements (allow for opencv-python or opencv-python-headless) #371
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was looking through the code and noticed that the
setup.py
was using a theparse_requirements
function that I wrote some time back. I also noticed there was an explicit dependency onopencv-python
. This causes issues for reasons that I outline in an mmdet PR: open-mmlab/mmcv#2775I've made a few changes / upgrades:
requirements.txt
->requirements/runtime.txt
requirements/cv2.txt
. andrequirements/cv2-headless.txt
requirements/runtime.txt
andrequirements/cv2.txt
(this means thatpip install -r requirements.txt
works exactly as before).requirements/runtime.txt
, this means that to get a full install, the user will have to specifypip install -e .[cv2]
xorpip install -e .[cv2-headless]
, which unfortunately is unavoidable if you want to support the ability to use either version of the cv2 package. This is a minor breaking change.pip install -e .[runtime-strict,cv2-strict]
, which will install the package with dependencies pinned to the minimum version (very useful for testing / ensuring upstream package changes don't break your code).In summary this adds:
opencv-python
oropencv-python-headless
pip install -e .
to install all dependencies you have topip install -e .[cv2]
xorpip install -e .[cv2-headless]
or preinstall the opencv package you want.Pending review additional work that may need to be done: