PySide2 (Qt for python) installation on Jetson Xavier

Qt is not officially supported on embedded platforms (said the Qt official website).
I tried pip install PySide2 and apt-get install python3-pyside2 but both failed.
Is there a way to build it from source?
Appreciate if anyone would provide any experience :)

Hi,
The posts may help:

Please take a look.

1 Like

Hi DaneLLL,
Appreciate for your reply.
I’ll work with these methods, see if they also worked on Jetson Xavier.

This issue was finally resolved, thanks to DaneLLL’s help.
Here is the method to build Qt5 (and then PySide2 if you need Qt for Python) from source on Jetson devices:

  1. Download Qt source:
    if you need the whole Qt5 (~900MB):

    wget http://master.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz

    or
    qtbase (basic module such as QtCore, QtGui and QtWidget)(~90MB):

    wget http://master.qt.io/archive/qt/5.15/5.15.2/submodules/qtbase-everywhere-src-5.15.2.tar.xz

  2. configure and install Qt5 (here I used qtbase):

    tar -xpf qtbase-everywhere-src-5.15.2.tar.xz
    cd qtbase-everywhere-src-5.15.2/
    ./configure -xcb

    (must enable xcb here manually)
    Choose “o” to install Qt open source version.

    make -j4
    sudo make install

  3. Now we have Qt5 under /usr/local/Qt-5.15.2

  4. Before install PySide2, first we have to deal with some requirements:
    General requirements: Python: 3.5+, Qt: 5.12+, libclang: version10, CMake:3.1+, llvm: version10

    Here I personally suggest use synaptic to manage library:

    sudo apt-get install synaptic

    Then install the correct version of libclang and llvm via synaptic.

  5. Download and build PySide2:

    git clone http://code.qt.io/pyside/pyside-setup.git
    cd pyside-setup/
    git checkout 5.15.2

    I’m not sure whether the version of Qt5 and PySide2 must match. Anyway, here I used PySide2 5.12.2

    Finally, to install PySide2:

    sudo python setup.py install --qmake=/usr/local/Qt-5.15.2/bin/qmake

    (qmake is automatically installed with Qt5)

  6. Try PySide2 in Python:

    python
    from PySide2 import *

1 Like

Hi, when I try to run

sudo python setup.py install --qmake=/usr/local/Qt-5.15.2/bin/qmake

I got this error:

– LLVM_CONFIG: /usr/local/bin/llvm-config
CMake Error at data/shiboken_helpers.cmake:180 (message):
Unable to find the Clang library in /usr/local. Names tried: clang,
libclang.so, libclang.so.1.
Call Stack (most recent call first):
CMakeLists.txt:39 (setup_clang)

– Configuring incomplete, errors occurred!
See also “/home/xavier/pyside-setup/pyside3_build/py3.6-qt5.15.2-64bit-release/shiboken2/CMakeFiles/CMakeOutput.log”.
error: Error configuring shiboken2
Traceback (most recent call last):
File “setup.py”, line 296, in
setup_runner.run_setup()
File “/home/xavier/pyside-setup/build_scripts/setup_runner.py”, line 168, in run_setup
raise RuntimeError(msg)
RuntimeError:
setup.py invocation failed with exit code: 1.

Do you have any idea?
Thank you

Hi Ayuchan,
Not expert here, but there seems something wrong with clang and llvm.
See if you have them by using

dpkg -l | grep clang
dpkg -l | grep llvm

Make sure you have all general requirements: Python : 3.5+, Qt : 5.12+, libclang : version10, CMake :3.1+, llvm : version10
In step 4 of my previous reply, use sudo synaptic to open this APP, then install libclang and llvm. Note this process is done via GUI rather than command line.

Thank you very much, it works.

Hi, I tried to install the whole Qt5 in Jetson TX2 for PySIde2 by using the method that Muscle_Oliver wrote, and seems that PySide2 have been installed in Jetson Tx2.
But when I tried to run my code in terminal by using the command “python3 main.py”, I got the following error.

qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “”
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, webgl.

Aborted (core dumped)

And after typing “export QT_DEBUG_PLUGINS=1” in terminal before execute my code got the following information

QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/Qt-5.15.2/plugins/platforms” …
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqeglfs.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqeglfs.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“eglfs”
]
},
“archreq”: 0,
“className”: “QEglFSIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“eglfs”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqlinuxfb.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqlinuxfb.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“linuxfb”
]
},
“archreq”: 0,
“className”: “QLinuxFbIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“linuxfb”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqminimal.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqminimal.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“minimal”
]
},
“archreq”: 0,
“className”: “QMinimalIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“minimal”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqminimalegl.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqminimalegl.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“minimalegl”
]
},
“archreq”: 0,
“className”: “QMinimalEglIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“minimalegl”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqoffscreen.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqoffscreen.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“offscreen”
]
},
“archreq”: 0,
“className”: “QOffscreenIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“offscreen”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqvnc.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqvnc.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“vnc”
]
},
“archreq”: 0,
“className”: “QVncIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“vnc”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/QtHi, I tried to install the whole Qt5 in Jetson TX2 for PySIde2 by using the method that Muscle_Oliver wrote, and seems that PySide2 have been installed in Jetson Tx2.
But when I tried to run my code in terminal by using the command “python3 main.py”, I got the following error.-5.15.2/plugins/platforms/libqwayland-egl.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqwayland-egl.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“wayland-egl”
]
},
“archreq”: 0,
“className”: “QWaylandEglPlatformIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“wayland-egl”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqwayland-generic.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqwayland-generic.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“wayland”
]
},
“archreq”: 0,
“className”: “QWaylandIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“wayland”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.15.2/plugins/platforms/libqwebgl.so”
Found metadata in lib /usr/local/Qt-5.15.2/plugins/platforms/libqwebgl.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“webgl”
]
},
“archreq”: 0,
“className”: “QWebGLIntegrationPlugin”,
“debug”: false,
“version”: 331520
}

Got keys from plugin meta data (“webgl”)
QFactoryLoader::QFactoryLoader() checking directory path “/usr/bin/platforms” …
qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “”
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, webgl.

Aborted (core dumped)

Do you have any idea?
Thank you very much!