-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Milestone
Description
Bug summary
import matplotlib.pyplot
returns ModuleNotFoundError: No module named 'importlib_resources'
on Matplotlib version 8d2d4c2.
Can anyone reproduce this?
Code for reproduction
import matplotlib.pyplot as plt
Actual outcome
ModuleNotFoundError Traceback (most recent call last)
Cell In [3], line 1
----> 1 import matplotlib.pyplot as plt
File ~/Python/mpl/matplotlib/lib/matplotlib/pyplot.py:55
53 import matplotlib.image
54 from matplotlib import _api
---> 55 from matplotlib import rcsetup, style
56 from matplotlib import _pylab_helpers, interactive
57 from matplotlib import cbook
File ~/Python/mpl/matplotlib/lib/matplotlib/style/__init__.py:1
----> 1 from .core import available, context, library, reload_library, use
4 __all__ = ["available", "context", "library", "reload_library", "use"]
File ~/Python/mpl/matplotlib/lib/matplotlib/style/core.py:26
22 import importlib.resources as importlib_resources
23 else:
24 # Even though Py3.9 has importlib.resources, it doesn't properly handle
25 # modules added in sys.path.
---> 26 import importlib_resources
28 import matplotlib as mpl
29 from matplotlib import _api, _docstring, _rc_params_in_file, rcParamsDefault
ModuleNotFoundError: No module named 'importlib_resources'
Expected outcome
Successful import.
Additional information
The error is from lib/matplotlib/style/core.py.
Locally on Python 3.9.7, I can fix the error by changing the operator on line 21 from >=
to <=
. I don't know if that will help other python versions.
Operating system
Ubuntu
Matplotlib Version
commit 8d2d4c2
Matplotlib Backend
No response
Python version
3.9.7
Jupyter version
No response
Installation
No response
Metadata
Metadata
Assignees
Labels
No labels