QtQml installation in Raspberry pi - qt

I am stuck with one error while building PyQt5 for rasberry pi. I was successfully able to run the application which uses QQmlApplicationEngine on Windows Desktop. Now I wanted to run the same application in Raspberry pi 3. I build the PyQt5 (5.4.1v) from the source and tried running the application but I get error:
ImportError: No Module Found "PyQt5.QtQml".
I realized that, when I build the PyQt5 from the source, I get:
Project Error: Unknown module(s) in QT: qml
and shows me a list of modules which will be built.
Just for a reference, I am using a raspbian, and have installed the following before building PyQt5.
sudo apt-get update
sudo apt-get install qtcreator
sudo apt-get install qt5-qmake
added "export QT_SELECT = qt5" to my "~/.profile" and "~/.bashrc"
sudo apt-get install qt5-default qt5-qmake qtbase5-dev-tools qttools5-dev-tools build-essential libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev libgl1-mesa-dev
How am I supposed to install QtQml in PyQt5? Please help...
Thanks in Advance.

PyQt5 is (as you perhaps know) just a wrapper for the Qt C++ libraries. In order to use a specific module in PyQt5 the underlying C++ library needs to be installed.
The first error message shows that PyQt5.QtQml module is missing which respectively leads to the conclusion that the underlying Python wrapper is missing.
The second error message is probably generated on the C++ level and means that the required Qt C++ library for this module is missing.
Since you are building PyQt5 you not only need the runtime libraries but also the development packages for Qt. For QML you need the qtdeclerative5-dev package and the libqt5qml5 (I think that was the name for the runtime library). These of course depend on a bunch of other packages which will automatically be installed.
PS: Don't forget the SIP library which PyQt has as a dependency no matter which Qt modules you want to use.

Related

libgssapi_krb5.so.2: undefined symbol: k5_sname_compare in while importing PyQt6.QtWebEngineWidgets [duplicate]

After installing anaconda3, I began to install pyside2.
I directly typed pip install pyside2, and successfully installed pyside2 5.15. But when I ran the toy example, an error occurred:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from PySide2.QtWidgets import QApplication, QLabel
ImportError: /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2: symbol krb5_ser_context_init version krb5_3_MIT not defined in file libkrb5.so.3 with link time reference
I when to /usr/lib/x86_64-linux-gnu and found both libgssapi_krb5.so.2 and libkrb5.so.3, and I have no idea how to fix this bug. Can anybody help me?
My environment:
python: 3.8.3
OS: ubuntu 18.04
CPU: AMD ryzen 3600
You are getting the error because you have a wrong version of qt on your machine. I mean it seems anaconda installs the wrong version of QT by default. First, you need to install essential packages (enter link description here) and then do the following steps:
pip uninstall pyside2, qt, pyqt5 if you have installed them with pip
conda remove pyside2, qt, pyqt5 if you have installed them with conda
conda install -c conda-forge pyside2
I had a similar issue, though I was not using anaconda. The error appears to be a krb5 version mismatch between PySide2 and Ubuntu packages. I was able to resolve the issue by compiling krb5 from source and adding the lib directory to LD_LIBRARY_PATH.
tar xf krb5-1.18.2.tar.gz
cd krb5-1.18.2/src
./configure --prefix=/opt/krb5/
make && make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/krb5/lib
python -c "import PySide2.QtCore"
The python import no longer raised an error. I found this worked with several different krb5 versions from the offical website; the error seems to be in the Ubuntu modifcations to the package.
You may have success with uninstalling and reinstalling the Python Qt bindings, as suggested by the other answers, but this did not work for me.
Just build in the pyside2 dependencies. if you wanna to use your virtual environment.
End build the Clang Library
I am sorry, your answer above seems correct except for the presence of opencv, which is not in the original question. Opencv in my opinion has nothing to do with pyside2 or the question. So, the correct procedure in my opinion would be:
1. pip uninstall pyside2, qt, pyqt5 if you have installed them with pip
2. conda remove pyside2, qt, pyqt5 if you have installed them with conda
3. conda install -c conda-forge pyside2

Cannot find serial port support in Qt 6.3.2

For some reason I should use Qt6 for my project. I need serial port functionality but Qt Creator cannot find corresponding module. The following error is raised:
Project ERROR: Unknown module(s) in QT: serialport. My .pro file includes serialport - it seems to me that the problem is in the absence of this module. Also I don't corresponding examples projects.
I tried to install libqt5serialport5 and libqt5serialport5-dev using commands:
sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev
but it didn't help. Please explain how to add serial port module to my Qt6 installation.
Below is information about my installation:
Qt Creator 8.0.2
Based on Qt 6.3.2 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), x86_64)
This problem has been solved very simple. Use Qt MaintenanceTool using which allows remove/update or install modules.

No qmlscene installed: why is a warning sign next to Qt version on Build&Run options

I don't understand why there is a yellow warning sign next to my manually-added Qt version of qmake, i.e. Qt 5.9.1 (qt5), hovering over the warning sign gives no additional info:
In the above screen-shot, it is mentioned:
No qmlscene installed
Suggested by this answer, I installed this but it couldn't help:
$ sudo apt install qtdeclarative5-dev
Why is there a warning? How can I resolve it? Will it affect my builds/runs in a crucial way?
QmlScene is an external QML preview application for Qt Quick 2 views. Qt Quick 1 has a tool called QmlViewer for same purpose. It seems to be packed separately on debian based system. Following command should get the package.
sudo apt-get install qmlscene
For those that didn't install GCC, you can try uninstalling QT and then re-installing but with GCC. This was my resolution which worked for me on Linux Mint 19 with QT 5.7.

Self-compile Qt Webkit

I have self-compiled Qt 5.4.1 and installed in /opt/qt-5.4.1.
However, I encountered an error while trying to 'qmake' my project file:
Project ERROR: Unknown module(s) in QT: webkitwidgets
I did sudo apt-get install libqt5webkit5-dev but the error persists.
I suspect then that apt-get install does not work when Qt-Core was self-compiled. The Qt Webkit source is available on https://qt.gitorious.org/qt
The question is, how and where should I install Webkit from source so that it can be detected while running qmake?
Probably you missed compilation of webkit while compilation of Qt. Read here how to resolve this issue:
https://forum.qt.io/topic/40378/solved-linux-unknown-module-s-in-qt-webkitwidgets
QtWebKit is not built anymore by default. You can build it after you have a proper build of Qt. Once you have your build of Qt clone the QtWebKit repo:
git clone https://github.com/qt/qtwebkit.git
then, make a new dir for the build files and from that directory enter the command:
/opt/qt-5.4.1/bin/qmake <path/to/qtwebkit>
make -j<n>
make install
Now you should be able to use QtWebKit with your build.
might want to try:
sudo apt-get install libqt5webkit5
and
sudo apt-get install libqt5webkit5-dev

in ubuntu 12.04 make cannot find Qt libraries

When I run make (after running qmake) I get the following error:
/usr/bin/ld: cannot find -lQtGui
/usr/bin/ld: cannot find -lQtCore
In synaptic it shows that I have installed libqtcore4 and libqtgui4.
There is no such directory as /usr/bin/ld.
Basically, I've installed the QtSDK, and QtCreator seems to work fine in that it can build the hello world program. But I want to be able to work from the CLI and run make. I suspect that I may need to redirect the make program to look elsewhere for QtGui and QtCore. If so, how do I find out where those libraries are? I'm running Ubuntu 12.04 and I've followed the advice of this page http://www.qtforum.org/article/28081/installing-qt-4-5-2-on-linux.html down to the last section where it talks about libraries. Any suggestions?
Install Qt using apt-get
sudo apt-get install libqt4-core libqt4-gui
or if you want everything
sudo apt-get install libqt4-*
The advice at http://www.qtforum.org/article/28081/installing-qt-4-5-2-on-linux.html is outdated and useless in your case since you have a recent version of Ubuntu. It leads to having two different versions of Qt side by side, which is technically possible but hard to manage.
You should install the qtcreator Ubuntu package and just delete the /opt/qtsdk... directory and undo the modifications suggested by the outdated instructions. It is essential that your PATH is not tweaked so that it's the Ubuntu version of qmake that is found when called from the command line.
If you still have compilation problems after that, they're likely to be solved by installing more packages, such as libqt4-dev or others Qt-related packages.
Also, /usr/bin/ld is not a directory, it's the linker program.

Resources