Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to upgrade qt 5.9.5 to 5.10.1 ??



  • Hi I'm planning to use PyQt5 on nvidia Xavier board which is arm64 architecture and Ubuntu 18.04.

    I've been install PyQt5 using

    sudo apt-get install python3-pyqt5

    and checked the version of pyqt and qt it sayes

    PYQT_VERSION = 330241
    PYQT_VERSION_STR = 5.10.1
    QOpenGLVersionProfile = <class 'PyQt5.QtGui.QOpenGLVersionProfile'>
    QOperatingSystemVersion = <class 'PyQt5.QtCore.QOperatingSystemVersion'>
    QT_VERSION = 329989
    QT_VERSION_STR = 5.9.5

    Is it necessary to match the version of pyqt and qt? Is it the reason that getting error when using Qtgui.application ?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    No the numbers don't necessarily match.

    What problem do you have ?



  • Thanks for the reply! If the version isn't a problem could you give me a solution about following errors..? I've been stuck in a week to figure out but can't get a solution,,

    I;m running this script in python

    from pyqtgraph.Qt import QtCore, QtGui
    import pyqtgraph.opengl as gl
    import pyqtgraph as pg
    import numpy as np
    import sys
    import time
    
    class Visualizer(object):
        def __init__(self):
            self.traces = dict()
            self.app = QtGui.QApplication(sys.argv)
            self.w = gl.GLViewWidget()
            self.w.opts['distance'] = 40
            self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
            self.w.setGeometry(0, 110, 1920, 1080)
            self.w.show()
    
            self.phase = 0
            self.lines = 50
            self.points = 1000
            self.y = np.linspace(-10, 10, self.lines)
            self.x = np.linspace(-10, 10, self.points)
    
            for i, line in enumerate(self.y):
                y = np.array([line] * self.points)
                d = np.sqrt(self.x ** 2 + y ** 2)
                sine = 10 * np.sin(d + self.phase)
                pts = np.vstack([self.x, y, sine]).transpose()
                self.traces[i] = gl.GLLinePlotItem(
                    pos=pts,
                    color=pg.glColor((i, self.lines * 1.3)),
                    width=(i + 1) / 10,
                    antialias=True
                )
                self.w.addItem(self.traces[i])
    
        def start(self):
            if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
                QtGui.QApplication.instance().exec_()
    
        def set_plotdata(self, name, points, color, width):
            self.traces[name].setData(pos=points, color=color, width=width)
    
        def update(self):
            stime = time.time()
            for i, line in enumerate(self.y):
                y = np.array([line] * self.points)
    
                amp = 10 / (i + 1)
                phase = self.phase * (i + 1) - 10
                freq = self.x * (i + 1) / 10
    
                sine = amp * np.sin(freq - phase)
                pts = np.vstack([self.x, y, sine]).transpose()
    
                self.set_plotdata(
                    name=i, points=pts,
                    color=pg.glColor((i, self.lines * 1.3)),
                    width=3
                )
                self.phase -= .0002
    
            print('{:.0f} FPS'.format(1 / (time.time() - stime)))
    
        def animation(self):
            timer = QtCore.QTimer()
            timer.timeout.connect(self.update)
            timer.start(10)
            self.start()
    
    
    # Start event loop.
    if __name__ == '__main__':
        v = Visualizer()
        v.animation()
    

    and getting this errors,

    |==============================>>
    | Traceback (most recent call last):
    | File "/home/nvidia/pyqt_test.py", line 79, in <module>
    | v.animation()
    | File "/home/nvidia/pyqt_test.py", line 68, in animation
    | self.start()
    | File "/home/nvidia/pyqt_test.py", line 72, in start
    | QtGui.QApplication.instance().exec_()
    | File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 193, in paintGL
    | self.drawItemTree(useItemNames=useItemNames)
    | File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 233, in drawItemTree
    | self.drawItemTree(i, useItemNames=useItemNames)
    | File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 214, in drawItemTree
    | debug.printExc()
    | --- exception caught here ---
    | File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 207, in drawItemTree
    | glPushAttrib(GL_ALL_ATTRIB_BITS)
    | File "/usr/lib/python3/dist-packages/OpenGL/platform/baseplatform.py", line 402, in call
    | return self( *args, **named )
    | File "/usr/lib/python3/dist-packages/OpenGL/error.py", line 232, in glCheckError
    | baseOperation = baseOperation,
    | OpenGL.error.GLError: GLError(
    | err = 1282,
    | description = b'invalid operation',
    | baseOperation = glPushAttrib,
    | cArguments = (GL_ALL_ATTRIB_BITS,)
    | )
    |==============================<<
    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 207, in drawItemTree
    glPushAttrib(GL_ALL_ATTRIB_BITS)
    File "/usr/lib/python3/dist-packages/OpenGL/platform/baseplatform.py", line 402, in call
    return self( *args, **named )
    File "/usr/lib/python3/dist-packages/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
    OpenGL.error.GLError: GLError(
    err = 1282,
    description = b'invalid operation',
    baseOperation = glPushAttrib,
    cArguments = (GL_ALL_ATTRIB_BITS,)
    )

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 219, in drawItemTree
    if int(ver.split(b'.')[0]) < 2:
    ValueError: invalid literal for int() with base 10: b'OpenGL'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 193, in paintGL
    self.drawItemTree(useItemNames=useItemNames)
    File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 233, in drawItemTree
    self.drawItemTree(i, useItemNames=useItemNames)
    File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/opengl/GLViewWidget.py", line 225, in drawItemTree
    glPopAttrib()
    File "/usr/lib/python3/dist-packages/OpenGL/platform/baseplatform.py", line 402, in call
    return self( *args, **named )
    File "/usr/lib/python3/dist-packages/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
    OpenGL.error.GLError: GLError(
    err = 1282,
    description = b'invalid operation',
    baseOperation = glPopAttrib,
    cArguments = ()
    )



  • additionally I checked the gl_version it says

    glGetString(GL_VERSION) = 'bOpenGL ES 3.2 NVIDIA 31.1.0

    but my jetson tx2 board it says

    glGetString(GL_VERSION) = 4.6.0 NVIDIA 31.1.0

    How can i change OpenGL ES to OpenGL 4.6??


  • Lifetime Qt Champion

    Can you also share how you install your application dependencies. e.g. pyqtgraph.



  • I've installed pyqtgraph using got clone https://github.com/pyqtgraph/pyqtgraph.git system wide using
    python3 setup.py install

    PyQt5 with sudo apt-get install python3-pyqt5

    QtOpenGL with sudo apt-get install python3-pyqt5.qtopengl

    and PyOpenGL with sudo apt-get install python3-opengl (3.1.0)


Log in to reply