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

Fix: cv2.imshow hanging on Ubuntu #757

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JacoCronje
Copy link

What this does

Fixes cv2.imshow from hanging on Ubuntu. The code makes sure to initialize the opencv UI before torchvision gets imported.
torchvision is dependant on PyAV, which seems to be the root cause of the issue. If av gets imported before cv2, it clashes with the opencv UI and creates the hanging effect. torchvision imports av.

More information here: pytorch/vision#5940

How it was tested

After the code change, no more freezing for me. I'm running Ubuntu 22.04.4 LTS

@apockill
Copy link

Also worth noting that the root cause of this issue is ffmpeg versions being mismatched from what pypi's pyav is expecting. The fix for this is to have the correct ffmpeg dependencies, as demonstrated in this docker environment I put together and tested for lerobot.

#519

@ivelin
Copy link
Contributor

ivelin commented Feb 26, 2025

This would be a great fix. I had to reinstall the whole opencv stack and nvda dependencies as a workaround.

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.

4 participants