ImportError: cannot import name 'QtGui'

Hi there,

I am using Linux Mint 18.3 Cinnamon and I can’t start joulescope_ui. It seems PySide and Qt bindings do not work. Any tips what to look for?

I have installed joulescope_ui via pip3 also I am using python3.6

$ python3.6 -m joulescope_ui
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/main.py”, line 18, in
from joulescope_ui.command import parser_config
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/command.py”, line 21, in
from joulescope_ui.main import run
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/main.py”, line 27, in
from joulescope_ui.oscilloscope import Oscilloscope
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/oscilloscope/init.py”, line 15, in
from .oscilloscope import Oscilloscope
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/oscilloscope/oscilloscope.py”, line 16, in
from .signal import Signal
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/oscilloscope/signal.py”, line 16, in
from .signal_statistics import SignalStatistics, si_format
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/oscilloscope/signal_statistics.py”, line 15, in
from pyqtgraph.Qt import QtGui, QtCore
File “/usr/local/lib/python3.6/dist-packages/pyqtgraph/init.py”, line 13, in
from .Qt import QtGui
File “/usr/local/lib/python3.6/dist-packages/pyqtgraph/Qt.py”, line 47, in
from PySide import QtGui, QtCore, QtOpenGL, QtSvg
ImportError: cannot import name ‘QtGui’

I have noticed on the github page that a forked pyqtgraph is being installed so I have uninstalled pyqtgraph and pyside and ran this command from pyjoulescope_ui repository directory

sudo pip3 install -r requirements.txt

It indeed has downloaded pyqtgraph from forked address, but now I get another problem:

Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/miceuz/pyjoulescope_ui/joulescope_ui/main.py”, line 18, in
from joulescope_ui.command import parser_config
File “/home/miceuz/pyjoulescope_ui/joulescope_ui/command.py”, line 21, in
from joulescope_ui.main import run
File “/home/miceuz/pyjoulescope_ui/joulescope_ui/main.py”, line 22, in
from PySide2 import QtCore, QtWidgets
ImportError: libshiboken2.abi3.so.5.12: cannot open shared object file: No such file or directory

Appearently, libshiboken2 is installed, but it is of version 5.13.0. I have tried uninstalling it and installing version 5.12.4, but then I get this error:

Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/main.py”, line 18, in
from joulescope_ui.command import parser_config
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/command.py”, line 21, in
from joulescope_ui.main import run
File “/usr/local/lib/python3.6/dist-packages/joulescope_ui/main.py”, line 22, in
from PySide2 import QtCore, QtWidgets
ImportError: /usr/local/lib/python3.6/dist-packages/PySide2/QtCore.abi3.so: undefined symbol: ZN8Shiboken27setErrorAboutWrongArgumentsEP7_objectPKcPS3

Almost, but no cigar. Please help?

Just to be sure, I have deleted all the packages installed for python3.6 and ran sudo pip3 install joulescope_ui again to start clean.

Collecting joulescope_ui
Collecting pyqtgraph@ https://github.com/jetperch/pyqtgraph/tarball/c8548b3246d29ee84a1ef76ebf63a5bb0e39c917#egg=pyqtgraph-0.11.0.dev0requests>=2.0.0 (from joulescope_ui)
Collecting joulescope>=0.4.5 (from joulescope_ui)
Collecting python-dateutil>=2.7.3 (from joulescope_ui)
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
100% |████████████████████████████████| 235kB 1.0MB/s
Collecting pyside2>=-5.11.2 (from joulescope_ui)
Downloading https://files.pythonhosted.org/packages/3d/a1/9300c616621ba1d1a3426d98b59cd5403045eafaa0263e68e7d4d48a49e4/PySide2-5.13.0-5.13.0-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl (152.9MB)
100% |████████████████████████████████| 152.9MB 12kB/s
Collecting numpy>=1.15.2 (from joulescope_ui)
Downloading https://files.pythonhosted.org/packages/87/2d/e4656149cbadd3a8a0369fcd1a9c7d61cc7b87b3903b85389c70c989a696/numpy-1.16.4-cp36-cp36m-manylinux1_x86_64.whl (17.3MB)
100% |████████████████████████████████| 17.3MB 108kB/s
Collecting json5>=0.6.1 (from joulescope_ui)
Downloading https://files.pythonhosted.org/packages/30/44/062543d4a6718f99d82e5ecf9140dbdee8a03122f2c34fbd0b0609891707/json5-0.8.5-py2.py3-none-any.whl
Collecting pymonocypher>=0.1.0 (from joulescope>=0.4.5->joulescope_ui)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->joulescope_ui)
Collecting shiboken2==5.13.0 (from pyside2>=-5.11.2->joulescope_ui)
Downloading https://files.pythonhosted.org/packages/d5/e2/e121fa55a759a286588a4017f57f34c03e8b35722131a2189a4f0e84bbac/shiboken2-5.13.0-5.13.0-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl (792kB)
100% |████████████████████████████████| 798kB 451kB/s
Installing collected packages: numpy, pyqtgraph, python-dateutil, pymonocypher, joulescope, shiboken2, pyside2, json5, joulescope-ui
Found existing installation: numpy 1.11.0
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
Found existing installation: python-dateutil 2.4.2
Not uninstalling python-dateutil at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed joulescope-0.4.5 joulescope-ui-0.4.5 json5-0.8.5 numpy-1.16.4 pymonocypher-0.1.2 pyqtgraph-0.10.0 pyside2-5.13.0 python-dateutil-2.8.0 shiboken2-5.13.0

After this I get the same: cannot import name ‘QtGui’

Ok, I think I got it. How I ended up with a working software:

  • installed via pip3 install joulescope_ui
  • ran pip3 -r requirements.txt in repo directory (noticed that PySide2-5.12.0 is being installed)
  • uninstalled shiboken2
  • installed shiboken2 version 5.12.0 (by running pip3 install shiboken2==5.12.0)

After this I finally got the GUI.

Hi @miceuz and welcome to the Joulescope forum. Great to hear that you got this working. At about the same time you were dealing with this issue, I was also migrating the Joulescope UI from Qt5/PySide2 5.12.0 to 5.13.0, and I edited both setup.py and requirements.txt. I think that these changes would have made your install go much smoother. Great work tracking down the right dependencies. Working with the source should be much easier in the future, especially once pyqtgraph releases 0.11.0.