ImportError running pyqtgraph examples on linux

530 views
Skip to first unread message

James

unread,
Jun 14, 2021, 3:59:34 PM6/14/21
to pyqtgraph
I was trying to run the pyqtgraph examples on CentOS 7, and hit the following error:
  ImportError: /usr/lib64/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/QtGui.abi3.so)

I've not been able to solve it yet, and was hoping that I might find help on this list.

Thanks for your any help you can provide.

Full output (for pyqtgraph.examples and ldd on the libraries) is below.

$ python3 -m pyqtgraph.examples
Traceback (most recent call last):
  File "/home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 184, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/pyqtgraph/__init__.py", line 13, in <module>
    from .Qt import QtGui
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/pyqtgraph/Qt.py", line 153, in <module>
    from PyQt5 import QtGui, QtCore, QtWidgets, uic
ImportError: /usr/lib64/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/QtGui.abi3.so)


$ ldd /usr/lib64/libQt5Core.so.5
linux-vdso.so.1 =>  (0x00007ffdcbd96000)
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fd782d6b000)
libsystemd.so.0 => /usr/lib64/libsystemd.so.0 (0x00007fd782b39000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00007fd782923000)
libicui18n.so.50 => /usr/lib64/libicui18n.so.50 (0x00007fd782524000)
libicuuc.so.50 => /usr/lib64/libicuuc.so.50 (0x00007fd7821aa000)
libicudata.so.50 => /usr/lib64/libicudata.so.50 (0x00007fd780bd6000)
libpcre2-16.so.0 => /usr/lib64/libpcre2-16.so.0 (0x00007fd78096a000)
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fd780765000)
libgthread-2.0.so.0 => /usr/lib64/libgthread-2.0.so.0 (0x00007fd780563000)
libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007fd78022c000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fd77ff23000)
libm.so.6 => /usr/lib64/libm.so.6 (0x00007fd77fc21000)
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fd77fa0b000)
libc.so.6 => /usr/lib64/libc.so.6 (0x00007fd77f649000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd783435000)
libcap.so.2 => /usr/lib64/libcap.so.2 (0x00007fd77f444000)
librt.so.1 => /usr/lib64/librt.so.1 (0x00007fd77f23c000)
libselinux.so.1 => /usr/lib64/libselinux.so.1 (0x00007fd77f014000)
liblzma.so.5 => /usr/lib64/liblzma.so.5 (0x00007fd77edee000)
liblz4.so.1 => /usr/lib64/liblz4.so.1 (0x00007fd77ebd9000)
libgcrypt.so.11 => /usr/lib64/libgcrypt.so.11 (0x00007fd77e957000)
libgpg-error.so.0 => /usr/lib64/libgpg-error.so.0 (0x00007fd77e752000)
libresolv.so.2 => /usr/lib64/libresolv.so.2 (0x00007fd77e538000)
libdw.so.1 => /usr/lib64/libdw.so.1 (0x00007fd77e2f0000)
libattr.so.1 => /usr/lib64/libattr.so.1 (0x00007fd77e0eb000)
libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007fd77de89000)
libelf.so.1 => /usr/lib64/libelf.so.1 (0x00007fd77dc73000)
libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x00007fd77da63000)


$ sudo ldd /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/QtGui.abi3.so 
[sudo] password for jbattat: 
ldd: warning: you do not have execution permission for `/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/QtGui.abi3.so'
linux-vdso.so.1 =>  (0x00007ffe550e1000)
libQt5Gui.so.5 => /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5Gui.so.5 (0x00007f32fc7a6000)
libQt5Core.so.5 => /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5Core.so.5 (0x00007f32fbfaf000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f32fbc84000)
libc.so.6 => /lib64/libc.so.6 (0x00007f32fb8c3000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f32fb6a6000)
libGL.so.1 => /usr/lib64/nvidia/libGL.so.1 (0x00007f32fb376000)
libz.so.1 => /lib64/libz.so.1 (0x00007f32fb160000)
libm.so.6 => /lib64/libm.so.6 (0x00007f32fae5d000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f32fac47000)
libicui18n.so.56 => /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/Qt5/lib/libicui18n.so.56 (0x00007f32fa7ae000)
libicuuc.so.56 => /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/Qt5/lib/libicuuc.so.56 (0x00007f32fa3f5000)
libicudata.so.56 => /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/Qt5/lib/libicudata.so.56 (0x00007f32f8a12000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f32f880e000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f32f860b000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f32f82d4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f32fd43a000)
libnvidia-tls.so.352.79 => /usr/lib64/nvidia/tls/libnvidia-tls.so.352.79 (0x00007f32f80d0000)
libnvidia-glcore.so.352.79 => /usr/lib64/nvidia/libnvidia-glcore.so.352.79 (0x00007f32f563c000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f32f52fe000)
libXext.so.6 => /lib64/libXext.so.6 (0x00007f32f50eb000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f32f4ec3000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f32f4cbe000)





Ognyan Moore

unread,
Jun 14, 2021, 6:34:10 PM6/14/21
to pyqt...@googlegroups.com
Hi James,

I assume you have PyQt5 installed in your pyenv environment via pip?  If so; I would suggest trying to install PySide2 (or better yet, PySide6) instead and see if that works for you instead.  I haven't attempted to run PyQtGraph on CentOS, so I can't speak to any first-hand experience there, sorry!

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/e349f5b0-94b7-40f1-92af-5c4a8edf9e6dn%40googlegroups.com.

James

unread,
Jun 15, 2021, 10:31:58 AM6/15/21
to pyqtgraph
Thanks for the quick reply and suggestion. 
+ Yes -- I had already installed PyQt5 via pip in my pyenv.
+ I tried your suggestion (installing pyside6) but still get an error about PyQt5 (details below)... 

Can I force pyqtgraph to use pyside instead of qt?
I see that I can force pg to use pyside by importing it first:

import PySide2  ## this will force pyqtgraph to use PySide2 instead of PyQt5
import pyqtgraph as pg

Is there a similar way to force pg to use pyside when calling pyqtgraph.examples from the command line?

Thank you!

(dwadaq) $ pip install pyside6
Collecting pyside6
  Downloading PySide6-6.1.1-6.1.1-cp36.cp37.cp38.cp39-abi3-manylinux1_x86_64.whl (209.8 MB)
     |████████████████████████████████| 209.8 MB 6.2 kB/s 
Collecting shiboken6==6.1.1
  Downloading shiboken6-6.1.1-6.1.1-cp36.cp37.cp38.cp39-abi3-manylinux1_x86_64.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 18.8 MB/s 
Installing collected packages: shiboken6, pyside6
Successfully installed pyside6-6.1.1 shiboken6-6.1.1
(dwadaq) $ python3 -m pyqtgraph.examples
Traceback (most recent call last):
  File "/home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 184, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/pyqtgraph/__init__.py", line 13, in <module>
    from .Qt import QtGui
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/pyqtgraph/Qt.py", line 153, in <module>
    from PyQt5 import QtGui, QtCore, QtWidgets, uic
ImportError: /usr/lib64/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PyQt5/QtGui.abi3.so)

Ognyan Moore

unread,
Jun 15, 2021, 11:37:22 AM6/15/21
to pyqt...@googlegroups.com
> Is there a similar way to force pg to use pyside when calling pyqtgraph.examples from the command line?

Not as far as I know.  PyQtGraph used to offer some environment variable support, which were deprecated; but perhaps we should consider re-introducing them.  A number of other tools leverage the QT_API environment variable, with various possible values, but on a quick google search I'm not sure there is consensus on consistent values... I'll think about it a bit more.

If anyone has the time/motivation to get this implemented, we would certainly welcome a pull request to implement this functionality.

Ogi



Martin Chase

unread,
Jun 15, 2021, 9:33:23 PM6/15/21
to pyqt...@googlegroups.com
You can set PYQTGRAPH_QT_LIB to e.g. 'PySide2' and that should switch it.

Martin Chase

unread,
Jun 15, 2021, 9:36:14 PM6/15/21
to pyqt...@googlegroups.com
On Tue, Jun 15, 2021 at 6:33 PM Martin Chase <outofc...@gmail.com> wrote:
You can set PYQTGRAPH_QT_LIB to e.g. 'PySide2' and that should switch it.

...This isn't documented, that I can find, I just happened to notice it in the source.
 

Carlos Pascual-Izarra

unread,
Jun 16, 2021, 4:47:53 AM6/16/21
to pyqt...@googlegroups.com

You are right!

That solves it, I guess.

Just one note: from the code, I understand that if the variable is defined, it takes precedence over a pre-loaded module.


IMHO it makes more sense decide the binding in the following order of precedence:

1.- already loaded binding?

2.- environment variable?

3.- try all in a predefined order

4.- error


The current implementation in pyqtgraph flips 1 and 2

 
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v06ERxZph03U1t8nh-ObAnUgYgGvykZV5cbzVyYyrtb0Q%40mail.gmail.com.
-- 
+----------------------------------------------------+
 Carlos Pascual Izarra
 Scientific Software Coordinator
 Computing Division
 ALBA Synchrotron  [http://www.albasynchrotron.es]
 Carrer de la Llum 2-26
 E-08290 Cerdanyola del Valles (Barcelona), Spain
 E-mail: cpas...@cells.es
 Phone: +34 93 592 4428
+----------------------------------------------------+

James

unread,
Jun 16, 2021, 12:22:00 PM6/16/21
to pyqtgraph
Hi all,

I can confirm that setting this environment variable does force pg to use PySide6, but I still get an ImportError (now dealing with PySide6 instead of PyQt5). Seems like an issue with conflicting libraries or similar, specific to my machine, but I've not been able to sort it out. Any insights would be greatly appreciated.



$ export PYQTGRAPH_QT_LIB='PySide6'

$ python -m pyqtgraph.examples
PySide6/__init__.py: Unable to import Shiboken from /home/jbattat/dune/ElectricalMethod/DAQ/python, /usr/lib/root, /home/jbattat/pylibjb, /home/jbattat/dune/ElectricalMethod/DAQ/python, /home/jbattat/.pyenv/versions/3.8.1/lib/python38.zip, /home/jbattat/.pyenv/versions/3.8.1/lib/python3.8, /home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/lib-dynload, /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages
Traceback (most recent call last):
  File "/home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 184, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/jbattat/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/pyqtgraph/__init__.py", line 13, in <module>
    from .Qt import QtGui, mkQApp
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/pyqtgraph/Qt.py", line 186, in <module>
    from PySide6 import QtGui, QtCore, QtWidgets
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PySide6/__init__.py", line 111, in <module>
    _setupQtDirectories()
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/PySide6/__init__.py", line 60, in _setupQtDirectories
    from shiboken6 import Shiboken
  File "/home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/shiboken6/__init__.py", line 25, in <module>
    from shiboken6.Shiboken import *
ImportError: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/jbattat/.pyenv/versions/dwadaq/lib/python3.8/site-packages/shiboken6/libshiboken6.abi3.so.6.1)

Ognyan Moore

unread,
Jun 16, 2021, 1:34:21 PM6/16/21
to pyqt...@googlegroups.com
Hi Carlos.

I don't think an already imported binding should take precedence over the environment variable (welcome to hear arguments against this take).  The primary use-case I'm concerned about is matplotlib being installed/imported when installed from the main conda channel.  That version of matplotlib uses PyQt5 5.9 I believe, which pyqtgraph no longer supports.  So if a user has an environment variable set to use PySide2/6 bindings, but does:

import matplotlib as mpl
import pyqtgraph as pg

the import will likely raise an exception due to an unsupported Qt version, and not give a user a way out around it (I may be wrong with my understanding of the import mechanisms here though).

There is another solution to that use-case though, and that is to verify the version of the Qt binding is supported during the attempted import process, and to move to the next binding if the version is not supported.

Reply all
Reply to author
Forward
0 new messages