jeertmans / manim-slides

Tool for live presentations using manim
https://manim-slides.eertmans.be
MIT License
446 stars 48 forks source link

[BUG] QVideoWidget object hs no attribute videoSink #370

Closed samyytids closed 8 months ago

samyytids commented 8 months ago

Please explain the issue you're experiencing (with as much detail as possible):

When I try to run any manim project using manim-slides I get the following error:

manim-slides BasicExample QSocketNotifier: Can only be used with threads started with QThread Traceback (most recent call last): File "/home/samyytids/seminars/rm/seminar-3/venv/bin/manim-slides", line 8, in sys.exit(cli()) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/manim_slides/present/init.py", line 305, in present player = Player( File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/manim_slides/present/player.py", line 229, in init self.video_sink = self.video_widget.videoSink() AttributeError: 'QVideoWidget' object has no attribute 'videoSink'

I can't seem to find anything to fix this error, it occurs in a venv and with any project. I'm using ubuntu, sorry if I'm just missing something really obvious I feel like I have tried everything at this point.

Many thanks in advance!

jeertmans commented 8 months ago

Hello! To help you, I need to need to know the version of Manim Slides you are using, as well as the Qt bindings and their version.

You can obtain this information with pip freeze.

samyytids commented 8 months ago

Hello,

First off thanks for responding!

qt5-applications==5.15.2.2.3 qt5-tools==5.15.2.1.3 QtPy==2.4.1 manim==0.18.0 manim-slides==5.1.2

If this turns out to just be a versioning issue I am going to be so annoyed!

jeertmans commented 8 months ago

So the requirements you are listing do not include any Qt binding (qt5-applications and qt5-tools are not useful to Manim Slides), but you need some, see here.

If you didn't any Qt bindings installed, then you would have this error:

qtpy.QtBindingsNotFoundError: No Qt bindings could be found

Because you have another error, you have probably another Qt library installed, but that you did not list above. Because it uses qtpy, it should be one of the following: PyQt5, PyQt6, PySide2, or PySide6.

Can you maybe share the full output of pip freeze? Also, make sure that pip uses the same Python environment as manim-slides.

A good way to do so is via Python modules:

python -m pip freeze
python -m manim_slides BasicExample

[!NOTE] Here, manim_slides takes an underscore, because it uses its module name.

Last but not least, if you are on Python < 3.12, then I highly recommend using

pip install manim-slides[pyside6]

to avoid those kinds of issues.

samyytids commented 8 months ago

I'm using python 3.10.12, have now installed using [pyside6] and ran using python -m manim_slides ... And still getting the error.

Here's the whole output of pip freeze

annotated-types==0.6.0 av==11.0.0 certifi==2024.2.2 charset-normalizer==3.3.2 click==8.1.7 click-default-group==1.2.4 cloup==2.1.2 decorator==5.1.1 glcontext==2.5.0 idna==3.6 isosurfaces==0.1.0 Jinja2==3.1.3 lxml==5.1.0 manim==0.18.0 manim-slides==5.1.2 ManimPango==0.5.0 mapbox-earcut==1.0.1 markdown-it-py==3.0.0 MarkupSafe==2.1.5 mdurl==0.1.2 moderngl==5.10.0 moderngl-window==2.4.4 multipledispatch==1.0.0 networkx==3.2.1 numpy==1.26.3 opencv-python==4.9.0.80 packaging==23.2 Pillow==9.5.0 pycairo==1.25.1 pydantic==2.6.1 pydantic-extra-types==2.5.0 pydantic_core==2.16.2 pydub==0.25.1 pyglet==2.0.10 Pygments==2.17.2 PyQt5==5.15.10 PyQt5-Qt5==5.15.2 PyQt5-sip==12.13.0 pyrr==0.10.3 PySide6==6.5.2 PySide6-Addons==6.5.2 PySide6-Essentials==6.5.2 python-pptx==0.6.23 qt5-applications==5.15.2.2.3 qt5-tools==5.15.2.1.3 QtPy==2.4.1 requests==2.31.0 rich==13.7.0 rtoml==0.10.0 scipy==1.12.0 screeninfo==0.8.1 shiboken6==6.5.2 skia-pathops==0.7.4 srt==3.5.3 svgelements==1.9.6 tqdm==4.66.1 typing_extensions==4.9.0 urllib3==2.2.0 watchdog==3.0.0 XlsxWriter==3.1.9

jeertmans commented 8 months ago

Thanks!

Still the same error?

Also, are you sure to run from the correct Python environment? Because I have the exact same Python dependencies as you listed above, and it works :/

samyytids commented 8 months ago

How strange, I'm pretty sure it's running from the same environment.

To double check in case I've missed something obvious here, here's a step by step of what I have done so far.

open vsc python -m venv venv source venv/bin/activate terminal now has (venv) blah blah blah pip install (insert stuff listed above) manim file.py NameOfPresentation python -m manim_slides NameOfPresentation

I then get this error still: QSocketNotifier: Can only be used with threads started with QThread Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/manim_slides/main.py", line 73, in cli() File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/manim_slides/present/init.py", line 305, in present player = Player( File "/home/samyytids/seminars/rm/seminar-3/venv/lib/python3.10/site-packages/manim_slides/present/player.py", line 229, in init self.video_sink = self.video_widget.videoSink() AttributeError: 'QVideoWidget' object has no attribute 'videoSink'

jeertmans commented 8 months ago

Hum weird... can you try with python -m pip install "manim-slides[pyside6]"?

Not sure if pip points to the one from your venv on Windows.

samyytids commented 8 months ago

Apparently that fixed it!

Thank you so much!

jeertmans commented 8 months ago

You are welcome :) This is probably because Windows’s virtual environments expose pip3 and not pip, so pip points to your system installation :)

Glad it solved your issue :)