Dih5 / xpecgen

A python package with a GUI to calculate X-ray sPECtra GENerated in tungsten anodes.
GNU General Public License v3.0
19 stars 4 forks source link

Matplotlib name error with NavigationToolbar2TkAgg #19

Open easyXAFS opened 3 years ago

easyXAFS commented 3 years ago

Running with Matplotlib version 3.2.0.

Get the following error when trying to launch xpecgen gui.

(base) C:\Users\easyXAFS>xpecgen
Traceback (most recent call last):
  File "c:\tools\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\tools\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\tools\Anaconda3\Scripts\xpecgen.exe\__main__.py", line 4, in <module>
  File "c:\tools\anaconda3\lib\site-packages\xpecgen\xpecgenGUI.py", line 13, in <module>
    from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
ImportError: cannot import name 'NavigationToolbar2TkAgg' from 'matplotlib.backends.backend_tkagg' (c:\tools\anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py)

Seems to be a name change on the part of matplotlib: NavigationToolbar2TkAgg -> NavigationToolbar2Tk https://stackoverflow.com/questions/50330320/what-to-use-instead-of-navigationtoolbar2tkagg

I can submit a PR changing the names if that would be helpful.

Dih5 commented 3 years ago

Thank for the issue. I updated the API for modern matplotlib in b751995051787f91bd0ae3d82d4bb33e4f8c8b8c. However, I'm experiencing this open matplotlib bug in my computer when I run the new code: https://github.com/matplotlib/matplotlib/issues/12074

Hence, I will not update the main branch for the moment. Given that matplotlib issue dates from 2018, I think the best solution could be to use an older version of matplotlib (possibly in a virtualenv).

ericpace commented 1 year ago

Hi, just experienced the same NavigationToolbar2TkAgg error. Is there a matplotlib version that you would suggest installing? I tried installing v2.1.2 (since NavigationToolbar2TkAgg was deprecated as of 2.2) but ran into errors during the install. Probably a conflict with other packages or the Python version I tried (v3.10).

Since you have suggested a virtualenv dedicated for this tool, could list the required Python and package version numbers that you know work?

Thank you.