I have 2 pc (laptop and workstation), when I run code for version check I get on laptop:
computer
LAPTOP
OS props
Windows-7-6.1.7601-SP1
python props
('default', 'May 15 2013 22:44:16')
python version
2.7.5
OS bit and OS type
('64bit', 'WindowsPE')
check if system is 32bit or 64bit
('7fffffffffffffff', True)
numpy version
1.7.1
matplotlib version
1.3.0
and on workstation:
computer
WORKSTATION
OS props
Windows-7-6.1.7601-SP1
python props
('default', 'May 15 2013 22:44:16')
python version
2.7.5
OS bit and OS type
('64bit', 'WindowsPE')
check if system is 32bit or 64bit
('7fffffffffffffff', True)
numpy version
1.7.1
matplotlib version
1.3.0
the software is mainly the same except some additional packages. But when I try to run the following code on the workstation computer:
import numpy as np
import matplotlib
# matplotlib.use('QTAgg')
from matplotlib import pyplot as plt
I get the following error:
Traceback (most recent call last):
File "C:\Users\WORKSTATION\python\src\gibljiv_kontakt_E11_vzmet\preview_and_sort_measurement_data.py", line 9, in <module>
from matplotlib import pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 98, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py", line 28, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 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
I would like to know what is wrong and how can this be repaired? The code works (it does not return any error) if I uncomment the line:
matplotlib.use('QTAgg')
but as I use this for showing plots no plots are shown. Any suggestions what is wrong and how to fix this. I would like to add, that like a month ago before I updated python and python's packages on my workstation computer the matplotlib was working without problems, but now I get this error.
I installed it with Anaconda3 in windows 10. I used powershell in admin mode.
then I just
and then,
It worked in my case.
In case you want to avoid the reinstallation of Python, please use the following code to change the backend to QT4. Remember to install PySide and PyQt4 packages before adding this to your code.
I have solved the problem. Here is the solution procedure:
If I choose the repair option when uninstalling, it didn't solve the problem. Thanks for your help @cgohlke.
I was experiencing something similar just now. But then I realized I had accidentally installed the 64-bit Matplotlib into a 32-bit Python distribution [slaps self on forehead]. I promptly uninstalled Matplotlib and re-installed the 32-bit version and it works beautifully now. :-)
Kindly check your interpreter. The error means you are using incorrect bit of software. It can be your interpreter is for 32-bit but you're using matplotlib and python of 64-bit, or any among these that does not match. Just solved mine. Add new interpreter of 64-bit version.
After I installed Anaconda I uninstalled other version of python which I installed before and deleted the old libraries from C:\Python directory. Now it is working.