Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] IPython magic in Binder doesn't work #519

Open
4 tasks done
jeertmans opened this issue Jan 15, 2025 · 0 comments
Open
4 tasks done

[BUG] IPython magic in Binder doesn't work #519

jeertmans opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jeertmans
Copy link
Owner

jeertmans commented Jan 15, 2025

Terms

Describe the issue

Apparently, the %manim_slides magic seems to use an older version manim, which depends on FFMPEG, see:

/usr/local/lib/python3.11/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)

However, the printed version is 0.18.1, which shoul

Command

%%manim_slides -qm --progress_bar None CircleToSquare --manim-slides controls=true

Issue Type

Other

Python version

Python 3.11.11

Python environment

You are using Manim Slides version v5.3.0, but version v5.3.1 is available.
You should consider upgrading via pip install -U manim-slides
Manim Slides version: 5.3.0
Python executable: /usr/local/bin/python
Manim bindings:
/usr/local/lib/python3.11/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
	manim (version: 0.18.1)
	manimgl not found
No Qt API found, some Manim Slides commands will not be available

What is your platform?

Linux, Other (please precise below)

Other platform

Docker image

Manim Slides Python code

%%manim_slides -qm --progress_bar None CircleToSquare --manim-slides controls=true

class CircleToSquare(Slide):
    def construct(self):
        blue_circle = Circle(color=BLUE, fill_opacity=0.5)
        green_square = Square(color=GREEN, fill_opacity=0.8)
        self.play(Create(blue_circle))
        self.next_slide()
        
        self.play(Transform(blue_circle, green_square))

Relevant log output

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[2], line 1
----> 1 get_ipython().run_cell_magic('manim_slides', '-qm --progress_bar None CircleToSquare --manim-slides controls=true', '\nclass CircleToSquare(Slide):\n    def construct(self):\n        blue_circle = Circle(color=BLUE, fill_opacity=0.5)\n        green_square = Square(color=GREEN, fill_opacity=0.8)\n        self.play(Create(blue_circle))\n        self.next_slide()\n        \n        self.play(Transform(blue_circle, green_square))\n')

File /usr/local/lib/python3.11/site-packages/IPython/core/interactiveshell.py:2541, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2539 with self.builtin_trap:
   2540     args = (magic_arg_s, cell)
-> 2541     result = fn(*args, **kwargs)
   2543 # The code below prevents the output from being displayed
   2544 # when using magics with decorator @output_can_be_silenced
   2545 # when the last Python token in the expression is a ';'.
   2546 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File /usr/local/lib/python3.11/site-packages/manim_slides/ipython/ipython_magic.py:181, in ManimSlidesMagic.manim_slides(self, line, cell, local_ns)
    179 try:
    180     scene_cls = local_ns[config["scene_names"][0]]
--> 181     scene = scene_cls(renderer=renderer)
    182     scene.render()
    183 finally:
    184     # Shader cache becomes invalid as the context is destroyed

File /usr/local/lib/python3.11/site-packages/manim_slides/slide/base.py:43, in BaseSlide.__init__(self, output_folder, *args, **kwargs)
     40 def __init__(
     41     self, *args: Any, output_folder: Path = FOLDER_PATH, **kwargs: Any
     42 ) -> None:
---> 43     super().__init__(*args, **kwargs)
     44     self._output_folder: Path = output_folder
     45     self._slides: list[PreSlideConfig] = []

File /usr/local/lib/python3.11/site-packages/manim/scene/scene.py:147, in Scene.__init__(self, renderer, camera_class, always_update_mobjects, random_seed, skip_animations)
    145 else:
    146     self.renderer = renderer
--> 147 self.renderer.init_scene(self)
    149 self.mobjects = []
    150 # TODO, remove need for foreground mobjects

File /usr/local/lib/python3.11/site-packages/manim/renderer/cairo_renderer.py:54, in CairoRenderer.init_scene(self, scene)
     53 def init_scene(self, scene):
---> 54     self.file_writer: Any = self._file_writer_class(
     55         self,
     56         scene.__class__.__name__,
     57     )

File /usr/local/lib/python3.11/site-packages/manim/scene/scene_file_writer.py:88, in SceneFileWriter.__init__(self, renderer, scene_name, **kwargs)
     86 # fail fast if ffmpeg is not found
     87 if not ensure_executable(Path(config.ffmpeg_executable)):
---> 88     raise RuntimeError(
     89         "Manim could not find ffmpeg, which is required for generating video output.\n"
     90         "For installing ffmpeg please consult https://docs.manim.community/en/stable/installation.html\n"
     91         "Make sure to either add ffmpeg to the PATH environment variable\n"
     92         "or set path to the ffmpeg executable under the ffmpeg header in Manim's configuration."
     93     )

RuntimeError: Manim could not find ffmpeg, which is required for generating video output.
For installing ffmpeg please consult https://docs.manim.community/en/stable/installation.html
Make sure to either add ffmpeg to the PATH environment variable
or set path to the ffmpeg executable under the ffmpeg header in Manim's configuration.

Screenshots

No response

Additional information

No response

Recommended fix or suggestions

No response

@jeertmans jeertmans added bug Something isn't working help wanted Extra attention is needed labels Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant