[Fix] Add missing dependencies: opencv-python-headless and expecttest #1682
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.
Motivation
ModuleNotFoundErrorencountered when installing mmengine from source or running tests in a fresh environment.Currently, the
requirements/runtime.txtfile is missingopencv-python-headless, which is present inruntime_lite.txtbut not linked in the full runtime requirements. This causespip install .to create an environment wherecv2is missing.Additionally,
expecttestis required by the test suite but is missing fromrequirements/tests.txt.Modification
Added
opencv-python-headlesstorequirements/runtime.txtAdded
expecttesttorequirements/tests.txtBC-breaking
No
This change only adds missing dependencies to ensure the environment is built correctly. It does not remove or change existing APIs.
Use cases
Case 1: Installing from source
User clones the repo and runs
pip install .Before: ImportError: No module named
cv2After: OpenCV is installed as part of MMEngine installation
Case 2: Running tests
User runs
pytest testsBefore: Failed tests with ModuleNotFoundError: No module named
expecttestAfter: Tests run properly
Checklist
Pre-commit or other linting tools are used to fix the potential lint issues.
The modification is covered by complete unit tests. (N/A, this is a dependency fix)
If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDetection or MMPretrain. (Safe, adds missing dependencies only)
The documentation has been modified accordingly, like docstring or example tutorials. (N/A)