Repository: ManimCommunity/manim

Issue:
issue when using opengl as renderer
## Description of bug / unexpected behavior
<!--No module named 'moderngl.program_members' -->
When I tried to run the command: `manim --renderer=opengl interactive.py`, an error occurred saying that no such module. But I suppose this is something in the source code, does this mean there's something going on with moderngl?

## Expected behavior
<!-- Add a clear and concise description of what you expected to happen. -->
I think the program should run, and it does when I unflagged the renderer command.

## How to reproduce the issue
<!-- Provide a piece of code illustrating the undesired behavior. -->


<details><summary>Code for reproducing the problem</summary>

```
from manim import *



class InteractiveRadius(Scene):
    def construct(self):
        plane = NumberPlane()
        cursor_dot = Dot().move_to(3 * RIGHT + 2 * UP)
        red_circle = Circle(
            radius=5,
            color=RED
        )
        red_circle.add_updater(lambda mob: mob.become(
            Circle(
                radius=3,
                color=RED
            )
        ))

        self.play(Create(plane), Create(red_circle), FadeIn(cursor_dot))
        self.cursor_dot = cursor_dot
        self.interactive_embed()

    def on_key_press(self, symbol, modifiers):
        from pyglet.window import key as pyglet_key
        if symbol == pyglet_key.G:
            self.play(
                self.cursor_dot.animate.move_to(self.mouse_point.get_center())
            )
        super().on_key_press(symbol, modifiers)
```

</details>


## Additional media files
<!-- Paste in the files manim produced on rendering the code above. -->

<details><summary>Images/GIFs</summary>

<!-- PASTE MEDIA HERE -->

</details>


## Logs
<details><summary>Terminal output</summary>
<!-- Add "-v DEBUG" when calling manim to generate more detailed logs -->

```
$ manim --renderer=opengl interactive.py
Manim Community v0.17.2

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮                                                                          
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\cli\render\commands.py:97 in  │
│ render                                                                                           │
│                                                                                                  │
│    94 │   │   │   │   for SceneClass in scene_classes_from_file(file):                           │
│    95 │   │   │   │   │   with tempconfig({}):                                                   │
│    96 │   │   │   │   │   │   scene = SceneClass(renderer)                                       │
│ ❱  97 │   │   │   │   │   │   rerun = scene.render()                                             │
│    98 │   │   │   │   │   if rerun or config["write_all"]:                                       │
│    99 │   │   │   │   │   │   renderer.num_plays = 0                                             │
│   100 │   │   │   │   │   │   continue                                                           │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\scene\scene.py:223 in render  │
│                                                                                                  │
│    220 │   │   """                                                                               │
│    221 │   │   self.setup()                                                                      │
│    222 │   │   try:                                                                              │
│ ❱  223 │   │   │   self.construct()                                                              │
│    224 │   │   except EndSceneEarlyException:                                                    │
│    225 │   │   │   pass                                                                          │
│    226 │   │   except RerunSceneException as e:                                                  │
│                                                                                                  │
│ C:\Users\baichuanzhou\Desktop\ManimDL\interactive.py:20 in construct                             │
│                                                                                                  │
│   17 │   │   │   )                                                                               │
│   18 │   │   ))                                                                                  │
│   19 │   │                                                                                       │
│ ❱ 20 │   │   self.play(Create(plane), Create(red_circle), FadeIn(cursor_dot))                    │
│   21 │   │   self.cursor_dot = cursor_dot                                                        │
│   22 │   │   self.interactive_embed()                                                            │
│   23                                                                                             │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\scene\scene.py:1033 in play   │
│                                                                                                  │
│   1030 │   │   │   return                                                                        │
│   1031 │   │                                                                                     │
│   1032 │   │   start_time = self.renderer.time                                                   │
│ ❱ 1033 │   │   self.renderer.play(self, *args, **kwargs)                                         │
│   1034 │   │   run_time = self.renderer.time - start_time                                        │
│   1035 │   │   if subcaption:                                                                    │
│   1036 │   │   │   if subcaption_duration is None:                                               │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\utils\caching.py:65 in        │
│ wrapper                                                                                          │
│                                                                                                  │
│   62 │   │   │   "List of the first few animation hashes of the scene: %(h)s",                   │
│   63 │   │   │   {"h": str(self.animations_hashes[:5])},                                         │
│   64 │   │   )                                                                                   │
│ ❱ 65 │   │   func(self, scene, *args, **kwargs)                                                  │
│   66 │                                                                                           │
│   67 │   return wrapper                                                                          │
│   68                                                                                             │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\renderer\opengl_renderer.py:4 │
│ 39 in play                                                                                       │
│                                                                                                  │
│   436 │   │   │   self.animation_elapsed_time = scene.duration                                   │
│   437 │   │                                                                                      │
│   438 │   │   else:                                                                              │
│ ❱ 439 │   │   │   scene.play_internal()                                                          │
│   440 │   │                                                                                      │
│   441 │   │   self.file_writer.end_animation(not self.skip_animations)                           │
│   442 │   │   self.time += scene.duration                                                        │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\scene\scene.py:1200 in        │
│ play_internal                                                                                    │
│                                                                                                  │
│   1197 │   │   for t in self.time_progression:                                                   │
│   1198 │   │   │   self.update_to_time(t)                                                        │
│   1199 │   │   │   if not skip_rendering and not self.skip_animation_preview:                    │
│ ❱ 1200 │   │   │   │   self.renderer.render(self, t, self.moving_mobjects)                       │
│   1201 │   │   │   if self.stop_condition is not None and self.stop_condition():                 │
│   1202 │   │   │   │   self.time_progression.close()                                             │
│   1203 │   │   │   │   break                                                                     │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\renderer\opengl_renderer.py:4 │
│ 50 in render                                                                                     │
│                                                                                                  │
│   447 │   │   self.window.swap_buffers()                                                         │
│   448 │                                                                                          │
│   449 │   def render(self, scene, frame_offset, moving_mobjects):                                │
│ ❱ 450 │   │   self.update_frame(scene)                                                           │
│   451 │   │                                                                                      │
│   452 │   │   if self.skip_animations:                                                           │
│   453 │   │   │   return                                                                         │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\renderer\opengl_renderer.py:4 │
│ 70 in update_frame                                                                               │
│                                                                                                  │
│   467 │   │   for mobject in scene.mobjects:                                                     │
│   468 │   │   │   if not mobject.should_render:                                                  │
│   469 │   │   │   │   continue                                                                   │
│ ❱ 470 │   │   │   self.render_mobject(mobject)                                                   │
│   471 │   │                                                                                      │
│   472 │   │   for obj in scene.meshes:                                                           │
│   473 │   │   │   for mesh in obj.get_meshes():                                                  │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\renderer\opengl_renderer.py:3 │
│ 75 in render_mobject                                                                             │
│                                                                                                  │
│   372 │   │   │   │   primitive=mobject.render_primitive,                                        │
│   373 │   │   │   )                                                                              │
│   374 │   │   │   mesh.set_uniforms(self)                                                        │
│ ❱ 375 │   │   │   mesh.render()                                                                  │
│   376 │                                                                                          │
│   377 │   def get_texture_id(self, path):                                                        │
│   378 │   │   if repr(path) not in self.path_to_texture_id:                                      │
│                                                                                                  │
│ C:\Users\baichuanzhou\anaconda3\envs\manim\lib\site-packages\manim\renderer\shader.py:315 in     │
│ render                                                                                           │
│                                                                                                  │
│   312 │   │   else:                                                                              │
│   313 │   │   │   self.shader.context.disable(moderngl.DEPTH_TEST)                               │
│   314 │   │                                                                                      │
│ ❱ 315 │   │   from moderngl.program_members import Attribute                                     │
│   316 │   │                                                                                      │
│   317 │   │   shader_attributes = []                                                             │
│   318 │   │   for k, v in self.shader.shader_program._members.items():                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'moderngl.program_members'

```

<!-- Insert screenshots here (only when absolutely necessary, we prefer copy/pasted output!) -->

</details>


## System specifications

<details><summary>System Details</summary>

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```
</details>

<details><summary>LaTeX details</summary>

+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->



Discussion:
A simple workaround for this is to just replace the offending line at 

https://github.com/ManimCommunity/manim/blob/117563e1f01adafe675f011ad425a257753ec9f4/manim/renderer/shader.py#L315

with:

`from moderngl import Attribute`
Thanks man, it works.
I guess we still cant close it right? The bug is not fixed in the code base, even though the solution is simple.
well, you're right.
It looks like this is because of the release of `moderngl` `v5.8`.  If I downgrade to `v5.7.4` then I no longer get this error.

Resolving patch:
diff --git a/manim/renderer/shader.py b/manim/renderer/shader.py
--- a/manim/renderer/shader.py
+++ b/manim/renderer/shader.py
@@ -312,7 +312,7 @@ def render(self):
         else:
             self.shader.context.disable(moderngl.DEPTH_TEST)
 
-        from moderngl.program_members import Attribute
+        from moderngl import Attribute
 
         shader_attributes = []
         for k, v in self.shader.shader_program._members.items():


Test patch: