3b1b / manim

Animation engine for explanatory math videos
MIT License
69.31k stars 6.13k forks source link

InteractiveScene not being recognised #2219

Open rickdisi opened 1 week ago

rickdisi commented 1 week ago

Hi, I've just downloaded manim and can't get one last thing to work. The InteractiveScene argument within the class (as opposed to just the scene) is not working. It just is not being recognised by pylance. Also, when I have only 'manim_imports_ext' everything else from manim is not being recognised by pylance, where as when i use 'from manim import *', things seem to work, all except the InteractiveScene. So, for example, right now in the example provided below the InteractiveScene, Circle() and PINK are all not being recognised

How do I fix this issue? Here is the example:

from manim_imports_ext import *

class InteractiveCircle(InteractiveScene):
    def construct(self):
        circle = Circle()  # Create a circle
        circle.set_fill(PINK, opacity=0.5)
        self.add(circle)

        self.interact()  # Enable interactive mode
APF2000 commented 6 days ago

Hi, I'm not sure if your issue is the same as mine, but I have also just downloaded the repo and I'm getting libGL.so file error.

After running the sequence:

python3 -m venv .venv source .venv/bin/activate pip install -e . manimgl example_scenes.py OpeningManimExample

I get:

ManimGL v1.6.1 [12:51:39] INFO Using the default configuration file, which you can modify in config.py:361 /home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/default_con fig.yml
INFO If you want to create a local configuration file, you can create a config.py:362 file named custom_config.yml, or run manimgl --config
Traceback (most recent call last): File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/_moderngl.py", line 214, in init lib = ctypes.CDLL("libEGL.so") File "/usr/lib/python3.10/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: libEGL.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/bin/manimgl", line 8, in sys.exit(main()) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/main.py", line 22, in main scenes = manimlib.extract_scene.main(config) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/extract_scene.py", line 134, in main scenes = get_scenes_to_render(all_scene_classes, scene_config, config) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/extract_scene.py", line 107, in get_scenes_to_render return [ File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/extract_scene.py", line 108, in scene_from_class(scene_class, scene_config, config) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/extract_scene.py", line 86, in scene_from_class return scene_class(scene_config) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/scene/scene.py", line 113, in init self.window = Window(scene=self, self.window_config) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/manimlib/window.py", line 34, in init super().init(size=size, samples=samples) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/moderngl_window/context/pyglet/window.py", line 84, in init self.init_mgl_context() File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/moderngl_window/context/base/window.py", line 173, in init_mgl_context self._ctx = moderngl.create_context(require=self.gl_version_code) File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/moderngl/init.py", line 2242, in create_context ctx = get_context() File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/moderngl/init.py", line 2299, in get_context init_context() File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/moderngl/init.py", line 2281, in init_context loader = DefaultLoader() File "/home/arthurpfonseca/Documents/Prog/manim-1.7.0/.venv/lib/python3.10/site-packages/_moderngl.py", line 223, in init lib = ctypes.CDLL("libGL.so") File "/usr/lib/python3.10/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: libGL.so: cannot open shared object file: No such file or directory

APF2000 commented 6 days ago

Doing the same in the original manim repo does work though.

Varniex commented 6 days ago

@rickdisi is this pylance issue or ManimGL Issue?

Would you provide the error message you are getting when you run any scene?

Also, you don't need to include self.interact() in your code. It's already been included (in Scene.run()) when you run manimgl.

Varniex commented 6 days ago

@APF2000 It looks you are missing some file in the specified directory, python doesn't seem to find the directory or the file. I guess that's why you are getting OSError.

and, the ManimCE is the community version of Manim which was adapted from this repository.

The original Manim Repo is this one: ManimGL by 3b1b (Grant Sanderson)

APF2000 commented 6 days ago

@Varniex Hi, thanks for taking this issue!

I'm not sure how I can add this file to my path.

All I've done was following the README, what did I miss?