X Tutup
Skip to content

Matplotlib 2.0 cannot find PyQt5 (Windows) #7958

@jat255

Description

@jat255

Bug report

Bug summary

  • With Matplotlib 2.0 and PyQt5 (5.7.1), I cannot use the PyQt5 backend for interactive plotting

Code for reproduction

import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt

Actual outcome

Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\matplotlib\backends\qt_compat.py", line 172, in <module>
    from PySide import QtCore, QtGui, __version__, __version_info__
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python36\lib\site-packages\matplotlib\pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Python36\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:\Python36\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "C:\Python36\lib\site-packages\matplotlib\backends\backend_qt5.py", line 26, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "C:\Python36\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "C:\Python36\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "C:\Python36\lib\site-packages\matplotlib\backends\qt_compat.py", line 175, in <module>
    "Matplotlib qt-based backends require an external PyQt4, PyQt5,\n"
ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5,
or PySide package to be installed, but it was not found.

Expected outcome

  • This should not produce an error, ideally.

Matplotlib version

$ ipython                                                                                                    
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
$ pip show matplotlib
Name: matplotlib
Version: 2.0.0
Summary: Python plotting package
Home-page: http://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: BSD
Location: c:\python36\lib\site-packages
Requires: python-dateutil, six, pyparsing, numpy, cycler, pytz
$ pip show pyqt5
Name: PyQt5
Version: 5.7.1
Summary: Python bindings for the Qt cross platform UI and application toolkit
Home-page: https://www.riverbankcomputing.com/software/pyqt/
Author: Riverbank Computing Limited
Author-email: info@riverbankcomputing.com
License: GPL v3
Location: c:\python36\lib\site-packages
Requires: sip
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)

Both matplotlib and PyQt5 installed from pypi sources using pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup