ImportError: libOpenGL.so.0: cannot open shared object file: No such file or directory

Viewed 13712

When I am running my python program I am getting following error in my terminal.

Traceback (most recent call last):
  File "./encryption.py", line 6, in <module>
    from PySide6 import QtCore, QtWidgets, QtGui
ImportError: libOpenGL.so.0: cannot open shared object file: No such file or directory

How to solve it? The import statements in my program are

#!/usr/bin/env python3
import sys
import random
import re
import pyAesCrypt
from PySide6 import QtCore, QtWidgets, QtGui

2 Answers

run the following command, to install libopengl0 library it required to run the code.

sudo apt install libopengl0 -y

The problem is a bug in PySide 6, which is apparently caused by a bug in Qt 6. Until that's fixed, you have to install OpenGL separately from installing PySide 6.

I installed it on Ubuntu 20.04 with this command:

sudo apt-get install freeglut3 freeglut3-dev
Related