Skip to content

CI Unpin matplotlib<3.9 in doc build #29434

Closed

Description

@lesteve

In #29388 we pinned matplotlib<3.9 see in particular #29388 (comment).

This is a DeprecationWarning in matplotlib 3.9 turned into error in the CI:

matplotlib._api.deprecation.MatplotlibDeprecationWarning: The 'labels' parameter of boxplot() has been renamed 'tick_labels' since Matplotlib 3.9; support for the old name will be dropped in 3.11.

3 examples fail (DeprecationWarning turned into error): they have been fixed in #29471.

  • examples/inspection/plot_permutation_importance_multicollinear.py
  • examples/ensemble/plot_gradient_boosting_regression.py
  • examples/release_highlights/plot_release_highlights_0_22_0.py

See build log from one of the commit in this #29388.

The easiest work-around is likely to do some version comparison something like this (not tested):

from sklearn.utils.fixes import parse_version
import matplotlib

tick_labels = ...
# labels has been renamed to tick_labels in matplotlib 3.9. This code can be simplified when scikit-learn minimum supported version is 3.9
tick_labels_parameter_name = "tick_labels" if parse_version(matplotlib.__version__) >= parse_version("3.9") else "labels"
tick_labels_dict = {tick_labels_parameter_name: tick_labels}

plt.boxplot(..., **tick_labels_dict)

Activity

  1. added
    Needs Triage
    on Jul 8, 2024
  2. added and removed
    Needs Triage
    on Jul 8, 2024
  3. changed the title [-]Unpin matplotlib<3.9 in the CI[/-] [+]CI Unpin matplotlib<3.9[/+] on Jul 9, 2024
  4. changed the title [-]CI Unpin matplotlib<3.9[/-] [+]CI Unpin matplotlib<3.9 in doc build[/+] on Jul 10, 2024
  5. added
    Easy
    on Jul 10, 2024
  6. nithish08 commented on Jul 10, 2024

    @nithish08
    Contributor

    It looks like the build-doc-and-deploy workflow is running as expected: https://app.circleci.com/pipelines/github/scikit-learn/scikit-learn?branch=main. @lesteve, should we still keep this open?

  7. lesteve commented on Jul 11, 2024

    @lesteve
    MemberAuthor

    Yes we should keep it open 😉.

    In case you want to work on this, start with a single example and make sure there is no warning when you run it locally with matplotlib 3.9, for example examples/ensemble/plot_gradient_boosting_regression.py because it runs quite fast.

    The doc build works because we are pinning matplotlib<3.9, as you can tell for example from this build log.

    Once all the examples listed in this issue are fixed (i.e. they don't produce warnings with matplotlib 3.9), we will be able to use matplotlib 3.9 in the doc build.

  8. nithish08 commented on Jul 11, 2024

    @nithish08
    Contributor

    I opened a PR here - #29471. Please review when you get a chance.

  9. removed
    Easy
    on Jul 15, 2024
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