4

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.

deceze
  • 510,633
  • 85
  • 743
  • 889
qas2100
  • 61
  • 1
  • 4
  • Some light searching only found something for this specific error message over at the Russian SO: https://ru.stackoverflow.com/a/1506838. Maybe that helps already. – deceze Mar 23 '23 at 15:37
  • It would help if you showed the actual full traceback and error message; looks like there might be important information after that `:`. – deceze Mar 23 '23 at 15:46
  • @deceze I added the screenshot showing the entire traceback and error message in addition to the info after the ':' Fortunately your link to Russian SO actually contains a correct solution to my problem. Problem solved! Thank you for your help and I apologize for any confusion. :) This topic can be closed. – qas2100 Mar 23 '23 at 16:06

3 Answers3

3

Open Windows PowerShell and use this:

pip install msvc-runtime
deceze
  • 510,633
  • 85
  • 743
  • 889
1

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

Keitetsu
  • 11
  • 1
0

Try checking whether matplotlib library was imported twice

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 20 '23 at 19:08