postpop / videoreader

pythonic video reader
Apache License 2.0
13 stars 3 forks source link

Why not use `opencv-python-headless` also for newer versions of Python? #6

Open niksirbi opened 1 month ago

niksirbi commented 1 month ago

I noticed that the package depends on opencv-python instead of opencv-python-headless for Python versions >= 3.10.

dependencies = [
    'opencv-python-headless>=3.0; python_version < "3.10"',
    'opencv-python; python_version >= "3.10"',
]

I was wondering if there is a reason for that. Could it still use "headless" for newer versions?

Context

I'm developing a napari plugin using QT, and I'd like to also use napari-video, which depends on this package. However I keep hitting segmentation faults, and I have a strong suspicion they come a conflict between opencv-python and PyQt5. Uninstalling opencv-python and installing opencv-python-headless solves the issue on my end.

niksirbi commented 1 month ago

This is somewhat related to https://github.com/janclemenslab/napari-video/issues/3.

Perhaps it's also worth considering an alternative video backend...

postpop commented 1 month ago

Hi, I agree, the headless version is clearly preferable. We had a good reason for the version split in the dependencies, but I do not remember it anymore. Maybe at the time of writing the package, there was no headless version of the package for py>=3.10. Let me try and make opencv headless the dep for all python version and see what happens.

postpop commented 1 month ago

And yes, using pyav as the backend might be preferable. What @bjudkewitz has implemented here https://github.com/janclemenslab/napari-video/issues/3 looks great but it need some more testing before we can use it.

niksirbi commented 1 month ago

Thanks for the swift response, Jan. If the headless version could be made to work, it would untie my hands at least for now.

I'll chime in on the discussion under https://github.com/janclemenslab/napari-video/issues/3, because I also have a stake at having a robust video player in napari.

niksirbi commented 2 weeks ago

Thanks for releasing a version that only depends on opencv-python-headless @postpop, should this issue be closed?