3

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
Joys
  • 311
  • 3
  • 15

1 Answers1

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?

korakot
  • 37,818
  • 16
  • 123
  • 144
  • 1
    [Colab notebook with pyglet](https://colab.research.google.com/drive/12osEZByXOlGy8J-MSpkl3faObhzPGIrB). I can run master branch. The question is how to run shaders version. – Joys Mar 28 '20 at 07:35
  • Thanks! the current code is already advanced. It uses vitualdisplay to emulate a screen. So, pyglet can work, just for recording to a file. Maybe if you can somehow stream vdo, it will be very useful. – korakot Mar 28 '20 at 09:12
  • Thanks for your answer. I created a virtual display `from pyvirtualdisplay import Display display = Display(visible=0, size=(960, 540)) display.start()`. But I can't make it work with manim. – Joys Mar 28 '20 at 09:30
  • 1
    I fond a [colab which renders a video](https://colab.research.google.com/drive/1flu31ulJlgiRL1dnN2ir8wGh9p7Zij2t) but I'm not sure how to apply it to manim. – Joys Mar 28 '20 at 10:12