NodeGraphQt icon indicating copy to clipboard operation
NodeGraphQt copied to clipboard

ImportError: No Qt binding were found.

Open lihuaiguang opened this issue 2 years ago • 6 comments

Hi, I have the following error:


NodeGraphQt % python3 example_auto_nodes.py

Traceback (most recent call last): File "example_auto_nodes.py", line 3, in from NodeGraphQt import NodeGraph, setup_context_menu,
File "/Users/atx/Documents/Python/2021-NodeGraphQt/NodeGraphQt/init.py", line 76, in from .base.graph import NodeGraph, SubGraph File "/Users/atx/Documents/Python/2021-NodeGraphQt/NodeGraphQt/base/graph.py", line 9, in from Qt import QtCore, QtWidgets, QtGui File "/Users/atx/Documents/Python/2021-NodeGraphQt/docs/testenv/lib/python3.6/site-packages/Qt.py-1.3.6-py3.6.egg/Qt.py", line 1928, in _install() File "/Users/atx/Documents/Python/2021-NodeGraphQt/docs/testenv/lib/python3.6/site-packages/Qt.py-1.3.6-py3.6.egg/Qt.py", line 1876, in _install raise ImportError("No Qt binding were found.") ImportError: No Qt binding were found.


MacOS 11.5.2, Python 3.6

lihuaiguang avatar Sep 14 '21 06:09 lihuaiguang

Qt.py, the abstraction layer for PySide2/PyQt5 used by NodeGraphQt, requires at least one of these two Qt bindings to be installed. Simply install the one of your preference with the Python package manager pip3. I would generally recommend PySide since it is officially supported by The Qt Company and the licensing model is more liberal than the one of PyQt.

mara004 avatar Sep 14 '21 09:09 mara004

Thanks, @mara004, for the suggestion! After try to install the pyside2, I find a new error msg while running:

% python3 example.py
Error in importing class: cannot import name 'QtCore' from 'NodeGraphQt' (/Users/atx/Documents/Python/2021-NodeGraphQt/NodeGraphQt/init.py)

Anything wrong?

lihuaiguang avatar Sep 15 '21 05:09 lihuaiguang

I can reproduce the error message. However, the GUI still shows up correctly for me. There is one spot in example_auto_nodes/input_nodes.py where QtCore is wrongly imported from NodeGraphQt, but changing it did not fix the error messages. The related code apparently is getNodesRecursively() in example_nodes.__init__. Unfortuantely it's a bit hard to tell where the root cause of these errors is without having deeper insights into the code.

mara004 avatar Sep 15 '21 10:09 mara004

I can reproduce the error message. However, the GUI still shows up correctly for me. There is one spot in example_auto_nodes/input_nodes.py where QtCore is wrongly imported from NodeGraphQt, but changing it did not fix the error messages. The related code apparently is getNodesRecursively() in NodeGraphQt.__init__. Unfortuantely it's a bit hard to tell where the root cause of these errors is without having deeper insights into the code.

Same problem.

matsbohlinsson avatar Sep 15 '21 15:09 matsbohlinsson

Yeah, and a similar issue exists for the math nodes example (which seems a little bit broken in general...)

mara004 avatar Sep 15 '21 15:09 mara004

I have the same issue and cannot install into Python as part of QGIS. It already has PyQt5 but it doesn't work.

ClaireLush avatar Sep 14 '22 11:09 ClaireLush