Skip to content

[Bug]: Second call to .use() causes recursion error #20808

Closed

Description

@oliversheridanmethven

Bug summary

Repeated calls to mpl.use() causes a recursion error.

Code for reproduction

import matplotlib as mpl
mpl.use("TkAgg")
import matplotlib.pylab as plt
mpl.use("TkAgg")

Actual outcome

Using Python 3.9.6 and matplotlib version 3.4.2 on Mac OSX, this:

import matplotlib as mpl
mpl.use("TkAgg")
import matplotlib.pylab as plt
mpl.use("TkAgg")

gives:

Backend TkAgg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
  File "<input>", line 4, in <module>
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydev_ipython/matplotlibtools.py", line 70, in patched_use
    matplotlib.real_use(*args, **kwargs)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydev_ipython/matplotlibtools.py", line 70, in patched_use
    matplotlib.real_use(*args, **kwargs)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydev_ipython/matplotlibtools.py", line 70, in patched_use
    matplotlib.real_use(*args, **kwargs)
  [Previous line repeated 987 more times]
RecursionError: maximum recursion depth exceeded

Expected outcome

No error.

Operating system

OSX

Matplotlib Version

3.4.2

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Other libraries

No response

Installation

pip

Conda channel

No response

Activity

  1. jklymak commented on Aug 8, 2021

    @jklymak
    Member

    Can you try this without pycharm?

  2. jklymak commented on Aug 8, 2021

    @jklymak
    Member

    I believe this is a pycharm issue: fabioz/PyDev.Debugger#148 and will close here. They patch our matplotlib.use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions