From 3f97940f2259c2b29d498b58f9b139cc4f407bcc Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 16 Jun 2021 01:52:54 +0200 Subject: [PATCH] Backport PR #42006: DEP: move pkg_resources back inline in function (delayed import) --- pandas/plotting/_core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 00d87b707580d..302d5ede0ae86 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -7,8 +7,6 @@ Sequence, ) -import pkg_resources - from pandas._config import get_option from pandas._typing import IndexLabel @@ -1745,6 +1743,8 @@ def _load_backend(backend: str) -> types.ModuleType: types.ModuleType The imported backend. """ + import pkg_resources + if backend == "matplotlib": # Because matplotlib is an optional dependency and first-party backend, # we need to attempt an import here to raise an ImportError if needed.