Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

qt

pyqt

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

like image 353
Vinay Kumar Avatar asked Jan 16 '21 15:01

Vinay Kumar


People also ask

What does libGL importerror libGL so 1 mean?

ImportError: libGL.so.1: cannot open shared object file: No such file or directory but this is already installed and the latest version. NB: I am actually running this on Docker, and I am not able to check the OpenCV version.

Why can’t I open shared object file in Docker?

The importerror: libgl.so.1: cannot open shared object file: no such file or directory mainly occurs because of the missing dependencies of cv2 when you build the application with Docker. These dependencies will be present in the local instance and thus you will not get this error.

Why can't I run libopengl0 on PySide 6?

run the following command, to install libopengl0 library it required to run the code. 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.

How do I open an issue on GitHub?

Sign up for a free GitHub account to open an issue and contact its maintainers and the community. By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails. Already on GitHub?


Video Answer


2 Answers

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
like image 30
Don Kirkby Avatar answered Oct 14 '22 07:10

Don Kirkby


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

sudo apt install libopengl0 -y
like image 89
Vinay Kumar Avatar answered Oct 14 '22 05:10

Vinay Kumar