Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import matplotlib._png as _png Import: Error: DLL load failed: The specified module could not be found

I use the Anaconda Python distribution: Python 2.7 x64 with Windows 7 SP1 x64 Ultimate.

When I do import matplotlib.pyplot I get ImportError: DLL load failed: The specified module could not be found.. What could be the issue?

Full error stack:

Traceback (most recent call last):
  File "C:\svn\hw4\code\test_con.py", line 1, in <module>
    import matplotlib.pyplot 
  File "C:\Anaconda\lib\site-packages\matplotlib\pyplot.py", line 27, in <module>
    import matplotlib.colorbar
  File "C:\Anaconda\lib\site-packages\matplotlib\colorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "C:\Anaconda\lib\site-packages\matplotlib\collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "C:\Anaconda\lib\site-packages\matplotlib\backend_bases.py", line 56, in <module>
    import matplotlib.textpath as textpath
  File "C:\Anaconda\lib\site-packages\matplotlib\textpath.py", line 22, in <module>
    from matplotlib.mathtext import MathTextParser
  File "C:\Anaconda\lib\site-packages\matplotlib\mathtext.py", line 63, in <module>
    import matplotlib._png as _png
ImportError: DLL load failed: The specified module could not be found.

conda update -f numpy, conda update -f libpng, and conda update -f matplotlib did not help.

Output of conda list matplotlib:

C:\Anaconda>conda list matplotlib
# packages in environment at C:\Anaconda:
#
matplotlib                1.4.3               np110py27_2
matplotlib-venn           0.11                      <pip>

The issue appeared after running conda update --all.

like image 497
Franck Dernoncourt Avatar asked Nov 01 '15 05:11

Franck Dernoncourt


People also ask

How do you fix DLL load failed the specified module could not be found?

importerror: dll load failed: The specified module could not be found error occurs because of the incompatibilities of Microsoft Visual C++ (Visual studio) versions. The best way to fix this error (importerror: dll load failed) is to reinstall/ install the Microsoft Visual C++ distribution.


2 Answers

I fixed this on my Windows machine by adding [Anaconda]/Library/bin to my PATH.

like image 129
Dr. Pain Avatar answered Oct 03 '22 19:10

Dr. Pain


I have had this problem as well. It seems to have cropped up in the last week or two. It seems like something in the scipy stack was compiled incorrectly. In the near term:

conda install anaconda

will roll your system back to a stable anaconda distribtution.

like image 45
Marshall Markham Avatar answered Oct 03 '22 20:10

Marshall Markham