Search code examples
pythonlinuxqtubuntupyside

PySide6 segmentation fault on Ubuntu 18.04 (Relink issue)


This script is from the Qt for Python page:

import sys

from PySide6.QtCore import Qt

from PySide6.QtWidgets import QApplication, QLabel

                                                     

if __name__ == "__main__":

    app = QApplication(sys.argv)

    label = QLabel("Hello World", alignment=Qt.AlignCenter)

    label.show()

    sys.exit(app.exec_())

But I keep getting this error:

python3: Relink `/lib/x86_64-linux-gnu/libsystemd.so.0' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
python3: Relink `/lib/x86_64-linux-gnu/libudev.so.1' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
Segmentation fault (core dumped)

I installed PySide with pip3 install pyside6, my python version is 3.6.9, my ubuntu version is 18.04.


Solution

  • Have you tried installing it in a virtual environment? Maybe the system-wide installation make some pre-existing libraries interfere.

    Choose the folder where you want to install your virtual environment

    user@pc:~/$ python3 -m venv /path/to/new/virtual/virtualenvironment/my_venv
    

    Activate the new virtual env:

    user@pc:~/$ source /path/to/new/virtual/environment/bin/activate
    

    Install (locally) PySide6:

    (my_venv) user@pc:~/$ pip3 install pyside6
    

    Run the script from the virtual environment:

    (my_venv) user@pc:~/$ python3 my_qt_script.py