Skip to content

[Bug]: DeprecationWarning triggered from using distutils #21643

@johnthagen

Description

@johnthagen

Bug summary

distutils is deprecated in Python 3.10: https://docs.python.org/3/library/distutils.html

Matplotlib (as of 3.4.3) currently uses distutils, so users are met with DeprecationWarnings when using on Python 3.10.

    from matplotlib import pyplot 
.tox/py/lib/python3.10/site-packages/matplotlib/__init__.py:88: in <module>
    from distutils.version import LooseVersion
/usr/local/lib/python3.10/distutils/__init__.py:19: in <module>
    warnings.warn(_DEPRECATION_MESSAGE,
E   DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

Code for reproduction

from matplotlib import pyplot

Actual outcome

DeprecationWarning raised per summary.

Expected outcome

No DeprecationWarnings raised

Additional information

No response

Operating system

macOS

Matplotlib Version

3.4.3

Matplotlib Backend

No response

Python version

Python 3.10.0

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions