Closed
Description
Bug summary
import
ing matplotlib on a fresh Windows machine or container fails with the following traceback:
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\lib\site-packages\matplotlib\__init__.py", line 113, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "C:\Python\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Python\lib\site-packages\matplotlib\colors.py", line 56, in <module>
from matplotlib import _api, _cm, cbook, scale
File "C:\Python\lib\site-packages\matplotlib\scale.py", line 22, in <module>
from matplotlib.ticker import (
File "C:\Python\lib\site-packages\matplotlib\ticker.py", line 138, in <module>
from matplotlib import transforms as mtransforms
File "C:\Python\lib\site-packages\matplotlib\transforms.py", line 49, in <module>
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found.
AFAIK, the DLL that's being called for isn't displayed here but I suspect this is something from the MSVC runtime.
Code for reproduction
docker run -it python:3.11.1-windowsservercore-1809 powershell
pip install matplotlib
python
import matplotlib
Actual outcome
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\lib\site-packages\matplotlib\__init__.py", line 113, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "C:\Python\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Python\lib\site-packages\matplotlib\colors.py", line 56, in <module>
from matplotlib import _api, _cm, cbook, scale
File "C:\Python\lib\site-packages\matplotlib\scale.py", line 22, in <module>
from matplotlib.ticker import (
File "C:\Python\lib\site-packages\matplotlib\ticker.py", line 138, in <module>
from matplotlib import transforms as mtransforms
File "C:\Python\lib\site-packages\matplotlib\transforms.py", line 49, in <module>
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found.
Expected outcome
matplotlib imports without errors.
Additional information
I think the MSVC runtime is currently a dependency of matplotlib and the required DLL should be distributed with the wheel. If I run pip install msvc-runtime
the import works, maybe that package or something like it could be a transient OS-specific dependency.
Operating system
Windows 10
Matplotlib Version
Import fails (3.6.2, 3.6.1, 3.6.0)
Matplotlib Backend
Unknown, import fails
Python version
3.11.1
Jupyter version
N/A
Installation
pip