question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manim scene caching does not play well with the -n flag

See original GitHub issue

Here’s a scene

from manim import Scene, Integer, ShowCreation, Transform

class TestScene(Scene):
    def construct(self):
        number = Integer(0)
        self.add(number)
        for i in range(10):
            self.play(Transform(number, Integer(i)))

Problem 1

This scene cannot be rendered with manim -pl test.py -n5,10. That is, if the first time you render it, you try to render only a specific number of animations, it cannot be done. It can be rendered normally without specifying the -n flag: manim -pl test.py.

Problem 2

After successfully rendering with manim -pl test.py, I tried again manim -pl test.py -n5,10, but the whole scene is being rendered. The -n flag is ignored.

Comments

Judging by the output, I think this has to do with scene caching (cc @huguesdevimeux). I recommend that while we are working out the kinks of the scene cachinc system, we add a flag --disable_caching, so that it can still be used even while the caching system is not fully debugged.

UPDATE: even when using --disable_caching, you get the same behavior.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
huguesdevimeuxcommented, Aug 18, 2020

But my point is that file_writer_config[“skip_animations”] is never being restored back to its original value.

You’re right, and I don’t think it is an issue as it is set to false by default at each scene rendering (this flag is not meant to be used by the user in any way).

Lol. I’m glad we found the issue. I know you’re busy, but I don’t know how to proceed here. What would be the fix?

I’m not that busy, I’m just working on other things (tests) and this is my priority right now. But I will be able to take care of this in a few days, no doubt.

I think we should be smarter than what was implemented before. My idea would be to do some tricks with scene.num_plays in @handle_caching play and @handle_caching_wait: if scene.num_plays is between i and j, then we skip everything to the next iteration, if not, we can continue normally and it should work fine. This is just a draft if you don’t see really how to fix I will be able to work on it in a few days.

0reactions
leotrscommented, Aug 18, 2020

You’re right, and I don’t think it is an issue as it is set to false by default at each scene rendering (this flag is not meant to be used by the user in any way).

If it’s never touched by the user, and it’s only touched by each Scene instance, then it should be a member of Scene, not in the config. But we can leave that for another issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A deep dive into Manim's internals
This checks whether any animations have been played – and if so, it tells the SceneFileWriter to close the pipe to ffmpeg ....
Read more >
Problems with setting up the engine · Issue #314 · 3b1b/manim
I use the version of manim mentioned in the tutorial in the readme file which is in Python 2.7 and get this: Traceback...
Read more >
Finnicky LaTeX Error : r/manim - Reddit
The reason some MathTex renders worked are because it was using cached animations. As soon as I used the --flush_cache flag, all LaTeX...
Read more >
Manim – Camera and Graphs - slama.dev
from manim import * class SaveAndRestoreExample(Scene): def ... If we don't want to create random graphs manually, we can use the popular networkx...
Read more >
CLI flags and configuration - manim documentation
flag abbr function ‑‑help ‑h Show the help message and exit ‑‑version ‑v Display the version of manimgl ‑‑write_file ‑w Render the scene as a movie...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found