3b1b / manim

Animation engine for explanatory math videos
MIT License
68.01k stars 6.07k forks source link

BrokenPipeError Mac #845

Closed mattdeitke closed 4 years ago

mattdeitke commented 4 years ago

Whenever I try rendering clips > ~30 seconds, I occasionally get the BrokenPipeError bug:

Traceback (most recent call last):
  File "~/Dropbox/documents/code/manim/manim/manimlib/extract_scene.py", line 155, in main
    scene = SceneClass(**scene_kwargs)
  File "~/Dropbox/documents/code/manim/manim/manimlib/scene/scene.py", line 53, in __init__
    self.construct()
  File "~/Dropbox/documents/code/manim/manim/active.py", line 147, in construct
    self.wait(2.5)
  File "~/Dropbox/documents/code/manim/manim/manimlib/scene/scene.py", line 406, in wrapper
    func(self, *args, **kwargs)
  File "~/Dropbox/documents/code/manim/manim/manimlib/scene/scene.py", line 521, in wait
    self.add_frames(*[frame] * n_frames)
  File "~/Dropbox/documents/code/manim/manim/manimlib/scene/scene.py", line 543, in add_frames
    self.file_writer.write_frame(frame)
  File "~/Dropbox/documents/code/manim/manim/manimlib/scene/scene_file_writer.py", line 185, in write_frame
    self.writing_process.stdin.write(frame.tostring())
BrokenPipeError: [Errno 32] Broken pipe
Media will be written to ./media/. You can change this behavior with the --media_dir flag.

This bug does not always appear, and I'd estimate that it appears about 80% of the time at different points throughout the rendering process.

This bug seems different from all the previous BrokenPipeError's reported, and I'm really not sure what's causing it. It seems to only happen when there are a lot of animations. This has nothing to do with #669 and I'm not using a Conda environment (as in #536 + #492).

Any ideas what I can do?

mattdeitke commented 4 years ago

I am able to fairly easily reproduce this by creating a new virtualenv and running all the install commands listed here followed by

python3 manim.py example_scenes.py OpeningManimExample -pl

Which seems to be the longest example scene. Note: the other example scenes work (I suspect because they are shorter?)

mattdeitke commented 4 years ago

Edit: This old solution does not work in many cases.

I have submitted pull request #846 which does fix the issue.