Skip to content

Change default install to non-headless OpenCV#51

Closed
NoYume wants to merge 2 commits intomainfrom
fix/install-script
Closed

Change default install to non-headless OpenCV#51
NoYume wants to merge 2 commits intomainfrom
fix/install-script

Conversation

@NoYume
Copy link
Collaborator

@NoYume NoYume commented Mar 9, 2026

  • Changed pyproject.toml to install opencv-python by default instead of the headless version when using pip install -e .
  • Updated warning for headless users to change their install to the headless version of OpenCV in the teleop script

@NoYume NoYume requested review from Arpitrf and Copilot and removed request for Copilot March 9, 2026 06:09
Copilot AI review requested due to automatic review settings March 14, 2026 02:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Switches the default OpenCV dependency from headless to the GUI variant, and updates related install/runtime logic.

Changes:

  • Added opencv-python as a direct dependency in pyproject.toml
  • Added fix_opencv() in install.py to force-uninstall headless OpenCV and reinstall the GUI variant
  • Replaced the runtime cv2.imshow probe in teleop_robocasa.py with 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()
@NoYume NoYume closed this Mar 14, 2026
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