diffpy / diffpy.github.io

web hosting for www.diffpy.org
2 stars 12 forks source link

Running tuneconfig() in IPython console results in Attribute Error (v.2.2.1) #58

Closed p3rAsperaAdAstra closed 1 year ago

p3rAsperaAdAstra commented 1 year ago

General Info OS: Windows 10 Python: 3.8 pdfgetx3: 2.2.1

The error occurse when: Running tuneconfig() in IPython console

List of commands run:

Ran: pdfgetx3 myfile.xy --plot=gr,fq,sq

Returns: Installed qt5 event loop hook. Shell is already running a gui event loop for qt5. Call with no arguments to disable the current loop. Using matplotlib backend: QtAgg

Ran: tuneconfig()

Returns: This is where the error occurs. It opens up the tuneconfig window, but it remains blank/white.

Traceback: File diffpy/pdfgetx/pdfgetxapplication.py:279, in tuneconfig(self, plotids, pdfgetter, axeslist) File diffpy/pdfgetx/tuneconfig.py:518, in createTuneConfig(pdfgetter, **kwargs) File diffpy/pdfgetx/tuneconfig.py:123, in init(self, pdfgetter, plotids, axeslist, _resetinit) File diffpy/pdfgetx/tuneconfig.py:211, in _makeGUIFigure(self)

AttributeError: 'FigureCanvasQTAgg' object has no attribute 'set_window_title'

So I'm guessing that the issue is the use of the QtAgg backend? I have found an issue while googling that looks like it might hold the explanation for this error: https://github.com/matplotlib/matplotlib/issues/17716/

The solution in that case seems to be to just not include the 'set_window_title' command.

I do not know much about Qt, but it seems like the whole thing crashes simply because the tuneconfig window title is being set to the string "tuneconfig" and the Canvas Class doesn't recognize that method.

Was that method renamed in a different version of Qt? Does tuneconfig really need a title? Do I just need to change the version of one of my python libs?

image
sbillinge commented 1 year ago

This I think has been fixed. Please check diffpy-users group for discussion

S

On Wed, May 31, 2023 at 11:08 AM p3rAsperaAdAstra @.***> wrote:

General Info OS: Windows 10 Python: 3.8 pdfgetx3: 2.2.1

The error occurse when: Running tuneconfig() in IPython console

List of commands run:

Ran: pdfgetx3 myfile.xy --plot=gr,fq,sq

Returns: Installed qt5 event loop hook. Shell is already running a gui event loop for qt5. Call with no arguments to disable the current loop. Using matplotlib backend: QtAgg

Ran: tuneconfig()

Returns: This is where the error occurs. It opens up the tuneconfig window, but it remains blank/white.

Traceback: File diffpy/pdfgetx/pdfgetxapplication.py:279, in tuneconfig(self, plotids, pdfgetter, axeslist) File diffpy/pdfgetx/tuneconfig.py:518, in createTuneConfig(pdfgetter, *kwargs) File diffpy/pdfgetx/tuneconfig.py:123, in init(self, pdfgetter, plotids, axeslist, reset_init*) File diffpy/pdfgetx/tuneconfig.py:211, in _makeGUIFigure(self)

AttributeError: 'FigureCanvasQTAgg' object has no attribute 'set_window_title'

So I'm guessing that the issue is the use of the QtAgg backend? I have found an issue while googling that looks like it might hold the explanation for this error: matplotlib/matplotlib#17716 https://github.com/matplotlib/matplotlib/issues/17716

The solution in that case seems to be to just not include the 'set_window_title' command.

I do not know much about Qt, but it seems like the whole thing crashes simply because the tuneconfig window title is being set to the string "tuneconfig" and the Canvas Class doesn't recognize that method.

Was that method renamed in a different version of Qt? Does tuneconfig really need a title? Do I just need to change the version of one of my python libs? [image: image] https://user-images.githubusercontent.com/60529579/242239438-0b1df48d-7a21-4fc8-a024-35f177dd8136.png

— Reply to this email directly, view it on GitHub https://github.com/diffpy/diffpy.github.io/issues/58, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAOWUPLNVT74LEEBJ3EB4TXI4KCLANCNFSM6AAAAAAYVHDDL4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Simon Billinge Professor, Columbia University

p3rAsperaAdAstra commented 1 year ago

Ok so just for posterity if someone doesn't know about the google group:

This is the link to the relevant issue in the Google Group: https://groups.google.com/g/diffpy-users/c/166PxpIfLfM/m/wm5U-ZI5GgAJ

If you wish to downgrade you matplotlib version to one that will work, use: pip install --force-reinstall -v "matplotlib==3.4"

Best option is to create a virtual environment first using virtualenv and then installing the right matplotlib version as noted above.

Everything worked perfectly the moment I downgraded to matplotlib 3.4