Closed
Conversation
There was a problem hiding this comment.
Pull request overview
Switches the default OpenCV dependency from headless to the GUI variant, and updates related install/runtime logic.
Changes:
- Added
opencv-pythonas a direct dependency inpyproject.toml - Added
fix_opencv()ininstall.pyto force-uninstall headless OpenCV and reinstall the GUI variant - Replaced the runtime
cv2.imshowprobe inteleop_robocasa.pywith a package-metadata check
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Added opencv-python to dependencies |
| install.py | New fix_opencv() function to swap headless → GUI OpenCV, called unconditionally at end of install |
| scripts/teleop_robocasa.py | Replaced runtime GUI capability check with package metadata lookup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
858
to
+870
| if args.health_hud: | ||
| try: | ||
| test_img = np.zeros((1, 1, 3), dtype=np.uint8) | ||
| cv2.imshow("_probe", test_img) | ||
| cv2.destroyWindow("_probe") | ||
| cv2.waitKey(1) | ||
| except cv2.error: | ||
| print("Error: cv2.imshow is not available — your OpenCV build has no GUI support.") | ||
| print(" This usually happens when opencv-python-headless shadows opencv-python.") | ||
| print(" Fix with:") | ||
| print(" pip uninstall -y opencv-python-headless opencv-python") | ||
| print(" pip install opencv-python") | ||
| sys.exit(1) | ||
| import importlib.metadata as importlib_metadata | ||
| try: | ||
| importlib_metadata.version("opencv-python") | ||
| print("Note: opencv-python (GUI) is installed. If you are on a headless server,") | ||
| print(" consider switching to the headless variant:") | ||
| print(" pip uninstall -y opencv-python opencv-python-headless") | ||
| print(" pip install opencv-python-headless") | ||
| except importlib_metadata.PackageNotFoundError: | ||
| pass | ||
| except ImportError: | ||
| pass |
| if args.robocasa: | ||
| install_robocasa() | ||
|
|
||
| fix_opencv() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
pyproject.tomlto install opencv-python by default instead of the headless version when usingpip install -e .