Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib ImportError: DLL load failed while importing _cext

Matplotlib issue

How to get rid of this error when importing matplotlib (actually matplotlib.pyplot)?

ImportError: DLL load failed while importing _cext: The specified module could not be found

These are fresh Python and Pycharm installs after reinstalling Windows 10. I am using Python 3.11.2 and Pycharm Community Edition 2022.3.3

I did not experience this issue before reinstalling Windows. Most likely I've been using older versions of Python and Pycharm but not much older (don't remember which exactly), something like six to eight months old.

like image 292
qas2100 Avatar asked Mar 24 '26 07:03

qas2100


2 Answers

Open Windows PowerShell and use this:

pip install msvc-runtime
like image 153
deceze Avatar answered Mar 26 '26 21:03

deceze


If pip installation of msvc-runtime does not solve the problem, please check if the Microsoft Visual C++ Redistributable package is installed.

  • Latest supported Visual C++ Redistributable downloads | Microsoft Learn
like image 23
Keitetsu Avatar answered Mar 26 '26 19:03

Keitetsu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!