-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: DLL load failed with Matplotlib 3.3.1 on Windows #18292
Comments
I don't think this was an intentional change on our part, but fallout from a change in how we built the wheels (we changed from relying on @cgohlke to building the wheels with GH actions). @eamars Can you verify that the wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib do work for you? If so we can upload those while we try and sort out what we are doing wrong. |
Thanks @tacaswell , matplotlib‑3.3.1‑cp37‑cp37m‑win_amd64.whl as provided in https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib invokes VCRUNTIME140.dll instead. I guess the build environment might have a different version of VC++ installed. |
Please try the wheels from here. I checked them with objdump and they don't seem to depend on |
I pulled the wheels from @cgohlke, updated the build number, and am in the process of uploading those. You should be able to re-install matplotlib 3.3.1 after that (maybe in about 10 minutes) and not run into this issue. |
This issue is present again with matplotlib 3.3.2, 3.3.3 and 3.3.4. . matplotlib 3.3.0 3.3.1 work. System
Traceback
|
I have a similar error OS: Microsoft Windows 10 Pro
version: 10.0.19042
pip: 21.1.2
python: 3.9
matplotlib: 3.4.2 Error message: Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python39\lib\site-packages\matplotlib\__init__.py", line 107, in <module>
from . import _api, cbook, docstring, rcsetup
File "C:\Program Files\Python39\lib\site-packages\matplotlib\rcsetup.py", line 26, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Program Files\Python39\lib\site-packages\matplotlib\colors.py", line 82, in <module>
from matplotlib import _api, cbook, scale
File "C:\Program Files\Python39\lib\site-packages\matplotlib\scale.py", line 18, in <module>
from matplotlib.ticker import (
File "C:\Program Files\Python39\lib\site-packages\matplotlib\ticker.py", line 179, in <module>
from matplotlib import transforms as mtransforms
File "C:\Program Files\Python39\lib\site-packages\matplotlib\transforms.py", line 46, in <module>
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found. EDIT: matplotlib 3.3.1 works, 3.3.4 does not. |
This seems like an installation issue, please try recreating your virtual env. |
is issue resolved |
Issue is closed because we cannot reproduce. If you can reproduce with a clean environment and installation please open a new issue with all the steps taken so we can reproduce. Otherwise please take installation help questions to https://discourse.matplotlib.org thanks |
If you're still seeing something similar, it's probably a duplicate of #24704. |
I reproduced the issue on a windows machine (windows 10 IoT, build 1809 build 17763.3887) Python version 3.10.9 Using Sysinternals' "Process Monitor" (https://learn.microsoft.com/en-us/sysinternals/downloads/process-utilities), I can see
I was hoping that ---8<-------logging ------------------------------------------------------ $ python -m venv matplotlib-msvcp140.dll
$ source matplotlib-msvcp140.dll/Scripts/activate
(matplotlib-msvcp140.dll) $ pip install matplotlib==3.6.3
Collecting matplotlib==3.6.3
Downloading matplotlib-3.6.3-cp310-cp310-win_amd64.whl (7.2 MB)
---------------------------------------- 7.2/7.2 MB 11.8 MB/s eta 0:00:00
Collecting numpy>=1.19
Downloading numpy-1.24.1-cp310-cp310-win_amd64.whl (14.8 MB)
--------------------------------------- 14.8/14.8 MB 13.1 MB/s eta 0:00:00
Collecting packaging>=20.0
Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting contourpy>=1.0.1
Downloading contourpy-1.0.7-cp310-cp310-win_amd64.whl (162 kB)
-------------------------------------- 163.0/163.0 kB 9.5 MB/s eta 0:00:00
Collecting python-dateutil>=2.7
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
------------------------------------- 247.7/247.7 kB 14.8 MB/s eta 0:00:00
Collecting pillow>=6.2.0
Downloading Pillow-9.4.0-cp310-cp310-win_amd64.whl (2.5 MB)
---------------------------------------- 2.5/2.5 MB 13.1 MB/s eta 0:00:00
Collecting kiwisolver>=1.0.1
Downloading kiwisolver-1.4.4-cp310-cp310-win_amd64.whl (55 kB)
---------------------------------------- 55.3/55.3 kB 2.8 MB/s eta 0:00:00
Collecting cycler>=0.10
Downloading cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting pyparsing>=2.2.1
Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
---------------------------------------- 98.3/98.3 kB 5.5 MB/s eta 0:00:00
Collecting fonttools>=4.22.0
Downloading fonttools-4.38.0-py3-none-any.whl (965 kB)
------------------------------------- 965.4/965.4 kB 12.2 MB/s eta 0:00:00
Collecting six>=1.5
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pyparsing, pillow, packaging, numpy, kiwisolver, fonttools, cycler, python-dateutil, contourpy, matplotlib
Successfully installed contourpy-1.0.7 cycler-0.11.0 fonttools-4.38.0 kiwisolver-1.4.4 matplotlib-3.6.3 numpy-1.24.1 packaging-23.0 pillow-9.4.0 pyparsing-3.0.9 python-dateutil-2.8.2 six-1.16.0
(matplotlib-msvcp140.dll) $
(matplotlib-msvcp140.dll) $ python -c "import matplotlib"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\__init__.py", line 113, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\colors.py", line 56, in <module>
from matplotlib import _api, _cm, cbook, scale
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\scale.py", line 22, in <module>
from matplotlib.ticker import (
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\ticker.py", line 138, in <module>
from matplotlib import transforms as mtransforms
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\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.
(matplotlib-msvcp140.dll) $ python -c "import matplotlib"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\__init__.py", line 113, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\colors.py", line 56, in <module>
from matplotlib import _api, _cm, cbook, scale
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\scale.py", line 22, in <module>
from matplotlib.ticker import (
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\lib\site-packages\matplotlib\ticker.py", line 138, in <module>
from matplotlib import transforms as mtransforms
File "C:\Users\MXadmin\matplotlib-msvcp140.dll\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.
(matplotlib-msvcp140.dll) |
Lots of windows programs do install the MSVC runtime libraries. This may explain why the issue can't be reproduced on a lot of systems. Copying the missing dll to e.g. C:\Windows\System32 makes it go away. |
@xtofl Can you please try installing the nightly wheels: https://matplotlib.org/stable/users/installing/index.html#installing-a-nightly-build We have made changes to how the wheels are built that may solve this problem. |
Sure. Has the dll search path changed, or has the dll been shipped with the wheel? Could you point me to those changes? |
They are shipped in the wheel. #24724 |
Good news: that version does not show the problem (I had to remember removing the dll from my C:\Windows\System32 folder first). When looking through Process Monitor, I can see that msvcp140.dll is found in |
That worked for me!
I tried several of the top Google search results before I found this ticket: |
As of matplotlib#28687, our extensions depend on `VCRUNTIME140_1.dll`, and this was allowed because Python 3.8+ started shipping that file. The original report in matplotlib#18292 was for Python 3.7, which didn't ship the DLL, but we require Python 3.10 now, so it's safe again. Since we can use that dependency, there's no need to disable the option that started requiring it in the first place. As noted in the original blog post [1], this will make our extensions smaller, and slightly faster. [1] https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
Bug report
Bug summary
On some Windows machines (including Windows 10 and Windows 7), we experienced
ImportError: DLL load failed: The specific module could not be found
after upgrading from Matplotlib 3.3.0 to 3.3.1.Code for reproduction
import matplotlib
would trigger the import error while trying to import ft2font.Actual outcome
Expected outcome
No error should be presented.
Matplotlib version
print(matplotlib.get_backend())
): Qt5Agg**Further diagnose shows: **
Those computers which have DLL load failed don't have VCRUNTIME140_1.dll in DLL search path.
Solution
Installing the latest Visual Studio 2015, 2019 and 2019 redistributable should address the issue.
Question
Is changing in VC++ API (from 14 to 14.1) an intentional move on Matplotlib 3.3.1 for Windows release? If so, should the VC++ dependency to be added to Installation Guide?
The text was updated successfully, but these errors were encountered: