[mcstas-users] help!--AttributeError: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'

Peter Kjær Willendrup pkwi at fysik.dtu.dk
Tue Nov 1 07:40:34 CET 2022

Hello Lisa,

This is actually a well-known problem with the recent Python 3.10 release and the 2.7.1/3.1 releases, communicated to the mcstas-users mailinglist (https://mailman2.mcstas.org/pipermail/mcstas-users/2022q3/001478.html) website (https://www.mcstas.org) on September 23rd.

To correct both this mcplot-related problem and a similar mcgui-related problem, please

replace the following files within your installation folder:

$MCSTAS/tools/Python/mcgui/viewclasses.py - please replace by this new version: https://raw.githubusercontent.com/McStasMcXtrace/McCode/mccode-3/tools/Python/mcgui/viewclasses.py
$MCSTAS/tools/Python/mccodelib/pqtgfrontend.py - please replace by this new version https://raw.githubusercontent.com/McStasMcXtrace/McCode/mccode-3/tools/Python/mccodelib/pqtgfrontend.py

New stable releases of McStas should be released during November/December this year.

Best and sorry for the inconvenience,

Peter Willendrup

On 1 Nov 2022, at 03.21, 曾智蓉 <zengzr at ihep.ac.cn<mailto:zengzr at ihep.ac.cn>> wrote:


I'm using McStas to simulate the instrument. I uninstalled my old version of McStas and installed the version 2.7.1. But there is a problem with the 'plot' function. I can't use it. Error prompt always pops up when compiling. The error is as following:

 'mcplot-pyqtgraph C:\mcstas-2.7.1\source_test\13b20220704_20221031_165658

 loading system configuration

 mcplot error: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'

 Traceback (most recent call last):

 File "C:\\mcstas-2.7.1\\lib\\tools\\Python\\mcplot\\pyqtgraph\\mcplot.py", line 67, in <module>


 File "C:\\mcstas-2.7.1\\lib\\tools\\Python\\mcplot\\pyqtgraph\\mcplot.py", line 57, in main

 raise e

 File "C:\\mcstas-2.7.1\\lib\\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 "C:\mcstas-2.7.1\lib\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''

Can you give me some advice on how to solve this problem?

Best regards,


mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20221101/db68143a/attachment.html>

More information about the mcstas-users mailing list