import matplotlib._png as _png Import: Error: DLL load failed: The specified module could not be found
Solution 1
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.
Solution 2
I fixed this on my Windows machine by adding [Anaconda]/Library/bin to my PATH.
Solution 3
I fixed this by installing libpng:
conda install libpng
Solution 4
I suppose the related issue is here: https://github.com/conda/conda/issues/1753
I solved the same problem by re-installing Anaconda.
Solution 5
The SciPy stack which came by default with Anaconda was corrupted in my case.
conda and pip are two different package managers which you can use to install python packages. conda can install various packages, it installs python itself as a package. pip caters to python users.
The conda packages were corrupted, so removing that package, which came by default, and installing it again using pip worked for me.
Try the following:
1. Create a new environment
This step is performed only as a safety measure. You can skip this step.
Open Anaconda prompt and
conda create --name testtrial python=3 //install whichever version of Python you want
activate testtrial
2. Removing and installing new packages
conda remove matplotlib //required only if you skipped the first step and are working in the default(root) environment
pip install matplotlib
That should solve the problem.
A quick guide on working with conda.
Comments
-
Franck Dernoncourt almost 2 years
I use the Anaconda Python distribution: Python 2.7 x64 with Windows 7 SP1 x64 Ultimate.
When I do
import matplotlib.pyplot
I getImportError: 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
, andconda 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
. -
Dobbs_Head over 8 yearsThis didn't solve the issue for me. (Issue replicated on Windows 7 enterprise, python 3.4.3, Aanaconda 2.4.0)
-
Onlyjus over 8 yearsThis worked for me. PyQt4 has the same issue. As far as I understand the build scripts for Anaconda are changing... Might cause issues for a little. See here:github.com/spyder-ide/spyder/issues/2765#issuecomment-152216201
-
Franck Dernoncourt over 8 years@Onlyjus I first had the issue with PyQt4 indeed.
conda update -f matplotlib
solved it but then I had other errors... -
bastelflp over 8 yearsDirect link to summary with fixing instructions: github.com/conda/conda/issues/1753#issuecomment-154885530
-
Gordon Bean over 8 yearsThis did not solve the issue for me, but the libpng answer (@Vasco) did. (Windows 7, Python 3.4.3)