getting error using matplotlib while running with console

import matplotlib.pyplot as mtp
a=[10,24,12,90]
b=[1,3,5,10]
mtp.plot(b,a)

 

Matplotlib support failed
Traceback (most recent call last):
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 25, in do_import
    succeeded = activate_func()
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_code_executor.py", line 29, in <lambda>
    "matplotlib": lambda: activate_matplotlib(self.enableGui),
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 110, in activate_matplotlib
    gui, backend = find_gui_and_backend()
  File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 47, in find_gui_and_backend
    backend = matplotlib.rcParams['backend']
  File "D:\books\programming\python17\lib\site-packages\matplotlib\__init__.py", line 677, in __getitem__
    plt.switch_backend(rcsetup._auto_backend_sentinel)
  File "D:\books\programming\python17\lib\site-packages\matplotlib\pyplot.py", line 251, in switch_backend
    switch_backend(candidate)
  File "D:\books\programming\python17\lib\site-packages\matplotlib\pyplot.py", line 266, in switch_backend
    canvas_class = backend_mod.FigureCanvas
AttributeError: partially initialized module 'matplotlib.backends.backend_macosx' has no attribute 'FigureCanvas' (most likely due to a circular import)
Process finished with exit code 0

6
4 comments

Hello, 

Unfortunately, this is a bug https://youtrack.jetbrains.com/issue/PY-56370 please use the workaround: 

Apart from downgrading matplotlib to 3.5.3, you can disable File | Settings | Tools | Python Scientific | Show plots in tool window.

4

Hi Kai

If you downgrade the motplotlib version it will work. I use 3.5.3 it works. Uninstall matplotlib. Open command, type
pip uninstall matplotlib
then
pip install matplotlib==3.5.3

Kai

1

Run into the same problem, when I try to use mathplotlib in pycharm.

canvas_class = backend_mod.FigureCanvas
AttributeError: module 'backend_interagg' has no attribute 'FigureCanvas'. Did you mean: 'FigureCanvasAgg'?

0

Please sign in to leave a comment.