5

I can't seem to get MatPlotLib to work. I downloaded and installed the correct version (matplotlib-1.1.0.win32-py2.7.exe), and I already have numpy and scipy installed (and they work with no problems).

This is the error that I get:

C:\python code>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 95, in <module>
    new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py", line 25,
 in pylab_setup
    globals(),locals(),[backend_name])
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin
e 8, in <module>
    import Tkinter as Tk, FileDialog
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 38, in <module>
    import FixTk
  File "C:\Python27\lib\lib-tk\FixTk.py", line 65, in <module>
    import _tkinter
ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>

Any ideas?

1
  • python -c"import Tkinter" does not work. It says ImportError: DLL load failed: %1 is not a valid Win32 application. But both of those dlls are in Python27\DLLs... Commented Jun 4, 2012 at 21:09

3 Answers 3

7

This problem occurs when you have a previous 64-bit version of python that was incorrectly uninstalled.

Uninstalling both versions of python correctly, and then reinstalling 32-bit python fixed the problem.

Sign up to request clarification or add additional context in comments.

Comments

3

Zach the best way to install matplotlib in windows is to go for Python(x,y) as a Bundle. All the dependencies are solved, and you get a really cool IDE and the full documentation.

See Python(x,y) here,

2 Comments

+1 to counter the negative and for the suggestions. I would like to get my own install to work though.
@Zach, you should mark your question answer, or just edit your Question to include you solution. But do give a shot to PythonX,Y it comes with an amazing IDE.
0

Installing of 32-bit versions of all necessary libs will resolve the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.