McCode icon indicating copy to clipboard operation
McCode copied to clipboard

Newest pyqtgraph release (0.13) breaks mcplot/mxplot and mcdisplay/mxdisplay

Open willend opened this issue 1 year ago • 4 comments

Found via a fresh homebrew install on an M1 Mac,

mcdisplay/mxdisplay breaks with:

starting particle parsing
ended particle parsing
module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'

mcplot/mxplot breaks with:

mcplot error: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'
Traceback (most recent call last):
  File "/Users/pkwi/McStas/mcstas/3.x-dev/bin/../tools/Python/mcplot/pyqtgraph/mcplot.py", line 67, in <module>
    main(args)
  File "/Users/pkwi/McStas/mcstas/3.x-dev/bin/../tools/Python/mcplot/pyqtgraph/mcplot.py", line 57, in main
    raise e
  File "/Users/pkwi/McStas/mcstas/3.x-dev/bin/../tools/Python/mcplot/pyqtgraph/mcplot.py", line 49, in main
    plotter = pqtgfrontend.McPyqtgraphPlotter(graph, sourcedir=loader.directory, plot_func=plotfuncs.plot, invcanvas=args.invcanvas)
  File "/Users/pkwi/McStas/mcstas/3.x-dev/tools/Python/mcplot/pyqtgraph/../../mccodelib/pqtgfrontend.py", line 46, in __init__
    self.app = QtGui.QApplication(sys.argv)
AttributeError: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'. Did you mean: 'QGuiApplication'?

WORKAROUND: Downgrade to pyqtgraph v. 0.12.4

pip3.10 install pyqtgraph==0.12.4

willend avatar Sep 28 '22 19:09 willend

This has been observed with fresh installations on

  • Windows (installation via miniconda, run at install time)
  • macOS (mainly Silicon - installation via homebrew, run at install time)

May come at short notice on Linux systems also...

willend avatar Sep 30 '22 16:09 willend

Tried replacing according to this: AttributeError: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'. Did you mean: 'QGuiApplication'?

Followed by: AttributeError: module 'pyqtgraph' has no attribute 'GraphicsWindow'. Did you mean: 'GraphicsView'?

Which finally results in QWidget: Cannot create a QWidget without QApplication /Users/pkwi/McStas/mcstas/3.x-dev/bin/mcplot: line 63: 53985 Abort trap: 6 python3 ${LIB}/${TOOL}.py $*

willend avatar Sep 30 '22 16:09 willend

Commits 7542f0834b7e2e801dca2977f1031f3e9598f2dd (master) and 54c348b02fb20c6182866edd8ecd10096f7c25db (mccode-3) corrects mcplot code for pyqtgraph==0.13

willend avatar Oct 01 '22 20:10 willend

Commits c2ae39a5ef56285cd6d10e80fafb1eab7ed82871 (master) and 9c00bc227da16a7076d34aa016bbafb599163f43 (mccode-3) corrects mcdisplay code for pyqtgraph==0.13

willend avatar Oct 01 '22 20:10 willend

Fixed

farhi avatar Nov 08 '22 19:11 farhi