Using pyqtgraph with Xavier

Hi, I’m planning to use pyqtgraph in Xavier board flashed with jetpack 4.1.1

I installed pyqt5 using

sudo apt-get install python3-pyqt5  and pyqt5.qtopengl

and running the script of example code in pyqtgraph and throwing this error ,
how can i solve this problem?

import initExample
import sys
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl

app = QtGui.QApplication(sys.argv)
w = gl.GLViewWidget()
w.opts['distance'] = 20
w.show()
w.setWindowTitle('pyqtgraph example: GLViewWidget')

ax = gl.GLAxisItem()
ax.setSize(5,5,5)
w.addItem(ax)

b = gl.GLBoxItem()
w.addItem(b)

ax2 = gl.GLAxisItem()
ax2.setParentItem(b)

b.translate(1,1,1)

## Start Qt event loop unless running in interactive mode.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

Using PyQt5 (default graphics system)
[18:43:02]

|==============================>>
|  Traceback (most recent call last):
|    File "/home/nvidia/pyqtgraph/examples/GLViewWidget.py", line 38, in <module>
|      QtGui.QApplication.instance().exec_()
|    File "/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py", line 193, in paintGL
|      self.drawItemTree(useItemNames=useItemNames)
|    File "/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py", line 233, in drawItemTree
|      self.drawItemTree(i, useItemNames=useItemNames)
|    File "/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py", line 214, in drawItemTree
|      debug.printExc()
|    --- exception caught here ---
|    File "/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py", line 207, in drawItemTree
|      glPushAttrib(GL_ALL_ATTRIB_BITS)
|    File "/home/nvidia/.local/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
|      return self( *args, **named )
|    File "/home/nvidia/.local/lib/python3.6/site-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 “/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py”, line 207, in drawItemTree
glPushAttrib(GL_ALL_ATTRIB_BITS)
File “/home/nvidia/.local/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py”, line 402, in call
return self( *args, **named )
File “/home/nvidia/.local/lib/python3.6/site-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 “/home/nvidia/pyqtgraph/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 “/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py”, line 193, in paintGL
self.drawItemTree(useItemNames=useItemNames)
File “/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py”, line 233, in drawItemTree
self.drawItemTree(i, useItemNames=useItemNames)
File “/home/nvidia/pyqtgraph/pyqtgraph/opengl/GLViewWidget.py”, line 225, in drawItemTree
glPopAttrib()
File “/home/nvidia/.local/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py”, line 402, in call
return self( *args, **named )
File “/home/nvidia/.local/lib/python3.6/site-packages/OpenGL/error.py”, line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1282,
description = b’invalid operation’,
baseOperation = glPopAttrib,
cArguments = ()
)

Hi j_w102,

Please refer to below thread to see if can help:
[url]https://devtalk.nvidia.com/default/topic/1059065/jetson-agx-xavier/how-to-install-pyqt5-in-jetson-xavier-/post/5370679/#5370679[/url]

Hi there,

I have the same issue here, the provided like does not solve the issue. Since it seems to be sourced from an altered behavior between OpenGl and OpenGl ES.

Best,

D

I meet the same problem, and the provided solution does not work for me, too.

Best,
:D