ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
25.27k stars 1.76k forks source link

libEGL.so not found dispite having Mesa installed #3957

Closed krlhBlupine closed 1 week ago

krlhBlupine commented 1 week ago

Description of bug / unexpected behavior

Manim crashes instead of opening its interactive window, when I tell it to use OpenGl as the renderer. manim test.py -v DEBUG -p --renderer opengl: log.txt

Cursory looking around suggests that it might be looking for a file named something different than what Mesa actually provides on my system. Contents of /run/opengl-driver/lib are here: lib.txt

Expected behavior

I expected the program to run.

How to reproduce the issue

You might have to try to reproduce on NixOS.

Logs

Terminal output [debug_log.txt](https://github.com/user-attachments/files/17371078/debug_log.txt)

System specifications

System Details STATS: - Version: Manim Community v0.18.1 - RAM: 16G - OS: Linux (NixOS 24.11.20241009.5633bcf (Vicuna)) - DE: Hyprland (Wayland compositor) - OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.2 - Python version: 3.12.5 - Python packages: (all dependencies handled by nix) - pandas - requests - manim - ipython - jupyter - relevant [nixos-specific OpenGL info](https://nixos.wiki/wiki/OpenGL)

Additional comments

davidawesome02-backup commented 1 week ago

I found a workaround for this bug after finding it my self; if you properly have the deps installed, just add it to your LD_LIBRARY_PATH so its found by the system

I copied mine to a directory before doing that, but it should work for getting you running

(I copied them because they were named libEGL.1.so libGL.1.so so its just libEGL.so libGL.so in order to prevent errors, although this may not be requried)

henrikmidtiby commented 1 week ago

I have observed a similar issue on my computer (Ubuntu 22.04, python 3.10). The steps to recreate the issue and my workaround is shown below.

# Create a virtual environment and install manim in that environment
mkdir manimtemptest
cd manimtemptest/
python3 -m venv env
source env/bin/activate
pip install manim
# Try to render the file test.py with the opengl render.
# The first approach works fine
manim render test.py --renderer=opengl
# However when I want to see the preview it fails with the message
# that libEGL.so and libGL.so was not found.
manim test.py --renderer opengl -p
# Modifying line 214 and 223 in _moderngl.py, so they point towards
# libEGL.so.1 and libGL.so.1 instead of libEGL.so and libGL.so
gvim env/lib/python3.10/site-packages/_moderngl.py
# Now the renderer works fine with the preview
manim test.py --renderer opengl -p

And here is the content of test.py which was mentioned above.

from manim import *

class Test(Scene):
    def construct(self):
        text = Text("The derivative of a function 2",
                          font_size = 32).\
                          shift(3.3*UP)
        self.add(text.set_stroke(width=0))

        br = Brace(text).set_stroke(width=0)
        self.add(br)
behackl commented 1 week ago

This appears to be a problem out of our control, you will need to report this upstream at moderngl.

Feel free to reopen this if it turns out that we need to change something about the way how moderngl is used.