1

I'm just trying to plot a basic line chart with matplotlib of python. But I'm getting continuous errors and fixing one by one but stuck this time. I'm using Python 2.7 and below is the code I'm trying to run.

>>> import matplotlib.pyplot as plt
>>> plt.plot([1,2,3,4])
>>> plt.ylabel('some numbers')
>>> plt.show()

Below is the Traceback. What I'm missing?

> Traceback (most recent call last):   File "<pyshell#9>", line 1, in
> <module>
>     import matplotlib.pyplot as plt   File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 24, in
> <module>
>     import matplotlib.colorbar   File "C:\Python27\lib\site-packages\matplotlib\colorbar.py", line 27, in
> <module>
>     import matplotlib.artist as martist   File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 8, in
> <module>
>     from transforms import Bbox, IdentityTransform, TransformedBbox, \   File "C:\Python27\lib\site-packages\matplotlib\transforms.py", line
> 35, in <module>
>     from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox, ImportError: DLL load failed: %1 is not
> a valid Win32 application.
Cœur
  • 37,241
  • 25
  • 195
  • 267
sython
  • 29
  • 2
  • 9
  • Does `C:\Python27\lib\site-packages\matplotlib\__path.pyd` exist? – GWW Aug 01 '14 at 03:17
  • my first guess is a `matplotlib` install issue, the code is fine. – Gabriel Aug 01 '14 at 04:20
  • An identical problem appears to have been answered previously here: **[LINK](http://stackoverflow.com/questions/18898131/matplotlib-1-3-0-importerror-dll-load-failed-1-is-not-a-valid-win32-applicati)**. Try the accepted solution. – tyleha Aug 06 '14 at 17:13

1 Answers1

0

One possibility is that you have an older version of matplotlib installed for a different version of python, where the library was installed to a spot earlier on sys.path

e.g. I found an ancient version in %USER%\AppData\Roaming\Python\Python27\site-packages

gbronner
  • 1,907
  • 24
  • 39