0

I have installed PyQt5 using pip install pyqt5. Installation is successful. A pip install of matplotlib says all requirements have been met. When I then run matplotlib I receive the flowing error:

Traceback (most recent call last):
  File "", line 6, in <module>
    import matplotlib.pyplot as plt
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 62, in pylab_setup
    [backend_name], 0)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 15, in <module>
    from .backend_qt5 import (
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 19, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 54, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 140, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: DLL load failed: %1 is not a valid Win32 application.

Searching states that the installed packages are likely different bit version (eg. 32bit when I need 54 bit). How can I fix this?

Adriano Martins
  • 1,788
  • 1
  • 19
  • 23
AndrewA
  • 3
  • 1
  • Possible duplicate of [ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there](https://stackoverflow.com/questions/19019720/importerror-dll-load-failed-1-is-not-a-valid-win32-application-but-the-dlls) – Adriano Martins Apr 03 '18 at 16:40
  • I can import matplotlib but I cannot import pyplot. The link addresses openCV library which I am not using – AndrewA Apr 03 '18 at 18:23
  • But I think the answers still apply. The point is you have some incompatible binaries installed. This may happen if you installed e.g. matplotlib for 64bit, but pyqt for 32bit or so. – ImportanceOfBeingErnest Apr 03 '18 at 20:21

1 Answers1

0

if you do not use pyqt and matplotlib together, then try to install conda and separate their environments. I encountered such a problem and I did so. I don’t remember exactly what it was, but I remember that the qt 5.9 and qt 5.13 libraries were in conflict