Skip to content

TST: matplotlib 3.4.1 broke RTD with MatplotlibDeprecationWarning #11458

Open

Description

@pllim

You will see this error on CircleCI for mpldev and in the dev job of Actions:

INTERNALERROR> ValueError: Key backend: '' is not a valid value for backend; supported values are
['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo',
'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo',
'pdf', 'pgf', 'ps', 'svg', 'template']

You will see these warnings on RTD:

MatplotlibDeprecationWarning:
The validCap attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later.
  return getattr(obj, attr, *defargs)
MatplotlibDeprecationWarning:
The validJoin attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later.
  return getattr(obj, attr, *defargs)

pandas saw something similar for the warning and their fix is pandas-dev/pandas#32444

TODO

Activity

  1. changed the title [-]TST: matplotlib 3.4.1 warnings broke CI and RTD[/-] [+]TST: matplotlib 3.4.1 error and warnings broke CI and RTD[/+] on Apr 1, 2021
  2. github-actions commented on Apr 1, 2021

    @github-actions
    Contributor

    Greetings from Skynet!

    (A special day message.)

  3. pllim commented on Apr 1, 2021

    @pllim
    Author
  4. changed the title [-]TST: matplotlib 3.4.1 error and warnings broke CI and RTD[/-] [+]TST: matplotlib 3.4.1/dev error and warnings broke CI and RTD[/+] on Apr 1, 2021
  5. pllim commented on Apr 1, 2021

    @pllim
    MemberAuthor

    Nothing I tried work for the "missing backend," so I opened issue at matplotlib/matplotlib#19848 . (UPDATE: This is a bug upstream so nothing we can do until they fix it.)

    As for RTD, I am also not sure what is going on. The warning came from sphinx-automodapi without any useful info. So, a stop-gap patch to get RTD working again until we find out is at #11462 . Also opened issue at astropy/sphinx-automodapi#125 . (UPDATE: Might also be a bug upstream at matplotlib/matplotlib#19839 but something we can hack-patch until they fix it.)

  6. nstarman commented on Apr 2, 2021

    @nstarman
    Member

    @pllim. I know it's not elegant, but the following monkey-patch works and is safe on all matplotlib versions. It needs to be applied before subclassing Polygon.

    Polygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(
        "`.CapStyle`", "``matplotlib._enums.CapStyle``")
    Polygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(
        "`.JoinStyle`", "``matplotlib._enums.JoinStyle``")
    Polygon.set_capstyle.__doc__ = Polygon.set_capstyle.__doc__.replace(
        "`.CapStyle`", "``matplotlib._enums.CapStyle``")
    Polygon.set_joinstyle.__doc__ = Polygon.set_joinstyle.__doc__.replace(
        "`.JoinStyle`", "``matplotlib._enums.JoinStyle``")
    
  7. pllim commented on Apr 2, 2021

    @pllim
    MemberAuthor

    @nstarman , I did try that after being redirected to matplotlib/matplotlib#19839 but it didn't work for me. Couldn't be I did it wrong. If you can figure out how to apply it to astropy/visualization/wcsaxes/patches.py , please open PR!

  8. pllim commented on Apr 2, 2021

    @pllim
    MemberAuthor

    @nstarman -- correction: I did apply your patch (see #11464) but the patches alone weren't enough, not sure why.

  9. nstarman commented on Apr 2, 2021

    @nstarman
    Member

    @pllim hmm. that's odd. When I ran into this problem in #11118, I solved it with https://github.com/astropy/astropy/blob/54e25d3fea11d33bb9bb53e265174949d16da898/astropy/visualization/wcsaxes/patches.py

    I see in 11464 that the monkey-patch is only applied within an if-statement. I know it shouldn't matter, but what if it were outside of the if-statement? It is matplotlib version safe.

  10. pllim commented on Apr 2, 2021

    @pllim
    MemberAuthor

    @nstarman , given that you found this solution originally, do you want to open a PR and take credit for it?

  11. pllim commented on Apr 2, 2021

    @pllim
    MemberAuthor

    Ah, looks like you also patched docs/conf.py. I missed that part. 501c72b

  12. nstarman commented on Apr 2, 2021

    @nstarman
    Member

    @pllim. I removed that part of the patch because I found it didn't have an effect. The matplotlib docs use `.CapStyle`, which as a relative path can't be overridden or ignored by numpydoc xref.
    Thanks, I'll open a PR

  13. added and removed
    🔥Critical
    on Apr 2, 2021
  14. pllim commented on Apr 3, 2021

    @pllim
    MemberAuthor

    Update: Dev job should be green now. But looks like mpldev job on CircleCI needs some sort of data update.

  15. changed the title [-]TST: matplotlib 3.4.1/dev error and warnings broke CI and RTD[/-] [+]TST: matplotlib 3.4.1 broke RTD with MatplotlibDeprecationWarning[/+] on Apr 3, 2021
  16. neutrinoceros commented on Jun 14, 2024

    @neutrinoceros
    Contributor

    I guess this is vestigial and should be closed now ?
    At a minimum, it would be closed by #16557, I think

  17. pllim commented on Jun 14, 2024

    @pllim
    MemberAuthor

    Not sure, gotta ask @nstarman . See the first unchecked check box in TODO above. We worked around it instead of fixing the actual problem but I am not sure if the problem is still a problem.

  18. nstarman commented on Jun 14, 2024

    @nstarman
    Member
  19. neutrinoceros commented on Jun 15, 2024

    @neutrinoceros
    Contributor
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