krassowski / jupyter-manim

manim cell magic for IPython/Jupyter to show the output video
MIT License
194 stars 11 forks source link

Manim gifs not showing in builded jupyter book #33

Closed mscharling closed 2 years ago

mscharling commented 2 years ago

Describe the problem

I'm pretty new to the Jupyter Notebook/Book universe, so I'm sorry if this question seems silly.

I'm trying to integrate Manim animations into my Jupyter Book rendering my animations as gifs. But somehow I don't get an output when I open my build in Chrome. I just get the message:

<IPython.core.display.Image object>

I've tried to dig into different posts but nothing really seems to work. The funny thing is when I open my .ipynb file in jupyter-notebook and run my code-snip there is no problem. The problem occurs when I build my Jupyter Book.

This is the following code I'm able to execute in jupyter-notebook but somehow not when building the Jupyter Book:

`from manim import *

%%manim -v WARNING --progress_bar None -r 400,200 --format=gif --disable_caching HelloManim class HelloManim(Scene): def construct(self): self.camera.background_color = "#ece6e2" banner_large = ManimBanner(dark_theme=False).scale(0.7) self.play(banner_large.create()) self.play(banner_large.expand())`

Has anyone else tried this and knows why this issue occur?

Steps to reproduce

  1. Construct new Jupyter notebook-file
  2. Paste the code provided into a new code cell
  3. Execute the code cell (it's working, right?)
  4. Now build a Jupyter book with this notebook file (does it work for you?)
mscharling commented 2 years ago

I also posted it here but no response yet and I still can't get around this issue.

krassowski commented 2 years ago

From the code that you pasted I think that you are posting to an incorrect repository (this package does not have --format=gif but --save_as_gif etc). If you are using Manim Community Edition please see https://github.com/ManimCommunity/manim

mscharling commented 2 years ago

@krassowski The reason I'm using --format=gif is because my output keeps telling me:

[01/02/22 23:12:00] WARNING --save_as_gif is deprecated, please use --format=gif instead!

And if I use --save_as_gif still nothing comes up :/

krassowski commented 2 years ago

This line would need updating then to also include --format=gif:

https://github.com/krassowski/jupyter-manim/blob/d8462d99926f0d596726c21b30e6992400cc4224/jupyter_manim/__init__.py#L206

Could you try with --save_as_gif --base64 arguments please?

mscharling commented 2 years ago

@krassowski Okay, so I found out I was actually using ManimCE. I reinstalled everything and used manimlib instead and it worked as it should. I guess I'm closing this issue since it must have something to do with ManimCE as you suggested earlier.