Search code examples
pythonqtubuntuwindows-subsystem-for-linuxpyside6

PySide6 & WSL2: ImportError: libEGL.so.1


I'm using isolated with poetry/venv Python: 3.11.2 with Ubuntu WSL2 22.04

python app.py

Gives me the following error:

Traceback (most recent call last):
  File "/home/lara/projects/qtapp/app.py", line 4, in <module>
    from PySide6.QtGui import QGuiApplication
ImportError: libEGL.so.1: cannot open shared object file: No such file or directory

app.py:

from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine

app = QGuiApplication()
engine = QQmlApplicationEngine()

engine.load("myqmlfile.qml")

app.exec()

pyproject.toml dependencies

[tool.poetry.dependencies]
python = ">=3.11,<3.12"
pyside6 = "^6.4.3"

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.2"
pytest-cov = "^4.0.0"
isort = "^5.12.0"
black = "^23.3.0"
poethepoet = "^0.19.0"

Solution

  • You can search packages.ubuntu.com to figure out which package provides a certain file. In this case it's libegl1. Install it in WSL with:

    apt install libegl1