How to setup Pyglet to work with Manim in Colab?

人走茶凉 提交于 2020-04-16 02:15:07

问题


I'm trying to run shaders version of Manim in Colab. This version has to show rendered video in a live interactive window, as opposed to just writing mp4. I installed and imported everything without errors:

from manimlib.imports import *

but get an exception when run:

!python3 -m manim example_scenes.py OpeningManimExample

Media will be written to ./media/. You can change this behavior with the --media_dir flag.
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/content/manim/manim.py", line 5, in <module>
    manimlib.main()
  File "/content/manim/manimlib/__init__.py", line 11, in main
    scenes = manimlib.extract_scene.main(config)
  File "/content/manim/manimlib/extract_scene.py", line 104, in main
    scenes = get_scenes_to_render(all_scene_classes, config)
  File "/content/manim/manimlib/extract_scene.py", line 72, in get_scenes_to_render
    scene = scene_class(**scene_kwargs)
  File "/content/manim/manimlib/scene/scene.py", line 44, in __init__
    self.window = Window(self, **self.window_config)
  File "/content/manim/manimlib/window.py", line 21, in __init__
    super().__init__(**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/moderngl_window/context/pyglet/window.py", line 54, in __init__
    config=config,
  File "/usr/local/lib/python3.6/dist-packages/pyglet/window/xlib/__init__.py", line 165, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyglet/window/__init__.py", line 588, in __init__
    config = screen.get_best_config(config)
  File "/usr/local/lib/python3.6/dist-packages/pyglet/canvas/base.py", line 194, in get_best_config
    raise window.NoSuchConfigException()
pyglet.window.NoSuchConfigException

回答1:


Colab is run on the cloud.

It cannot use pyglet to open a new window on your computer for live realtime display.

So, shader version is impossible. Can you run mp4 version successfully?



来源:https://stackoverflow.com/questions/60886590/how-to-setup-pyglet-to-work-with-manim-in-colab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!