Tuesday, February 13, 2018

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

When I was trying to visualize a simple plot, this error: "ImportError: libGL.so.1: cannot open shared object file: No such file or directory" popped out of the blue when I was trying to debug my code.

Quick google search later, it was suggested that I use
import matplotlib
matplotlib.use("Agg")

Fine... and it did work! no more error message.... but also, i stopped seeing my plot! :)
No good.

After digging deeper, I discovered that Red Hat does not ship native OpenGL libraries, but does ship the Mesa libraries: an MIT licensed implementation of the OpenGL specification.
You can add the Mesa OpenGL runtime libraries on your system by installing the following package:

# sudo yum install mesa-libGL

Problem was solved!

Happy coding

No comments:

Post a Comment