Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated use of IPython.display.set_matplotlib_formats #1842

Closed
3 tasks done
ivirshup opened this issue May 17, 2021 · 3 comments · Fixed by #3499
Closed
3 tasks done

Deprecated use of IPython.display.set_matplotlib_formats #1842

ivirshup opened this issue May 17, 2021 · 3 comments · Fixed by #3499
Assignees
Milestone

Comments

@ivirshup
Copy link
Member

ivirshup commented May 17, 2021

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the master branch of scanpy.

Found while investigating #1477.

scanpy.set_figure_parms detects whether we're in an IPython session (or at least tries to #1841), and sets the default output format. The way it sets the format is deprecated, as it looks like the matplotlib_inline backend has moved to a separate package.

The new way to call this is:

            import matplotlib_inline.backend_inline

            if isinstance(ipython_format, str):
                ipython_format = [ipython_format]
            matplotlib_inline.backend_inline.set_matplotlib_formats(*ipython_format)

It may take some investigation to figure out how to do this in a backwards compatible way.

I would also note the current backend format that we are using ("png2x") is undocumented. It is equivalent to the documented format "retina".

@Orangon
Copy link

Orangon commented Sep 24, 2021

Yes! I solve my problem in this way! Thanks!

@Shaun-Regenbaum
Copy link

I am also seeing this

@flying-sheep
Copy link
Member

flying-sheep commented Mar 11, 2025

Damn, we should have fixed this immediately. It’ll be fixed with #3499, for now workarounds:

  1. downgrade IPython to 8.x
  2. import IPython.display
    from matplotlib_inline.backend_inline import set_matplotlib_formats
    IPython.display.set_matplotlib_formats = set_matplotlib_formats

@flying-sheep flying-sheep self-assigned this Mar 11, 2025
@flying-sheep flying-sheep added this to the 1.11.1 milestone Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants