0

When I load matplotlib in a new session in PyCharm I get the following error:

>>> import matplotlib
Backend Qt4Agg is interactive backend. Turning interactive mode on.
Failed to enable GUI event loop integration for 'qt4'
Traceback (most recent call last):
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 563, in do_enable_gui
    enable_gui(guiname)
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/pydev_ipython/inputhook.py", line 528, in enable_gui
    return gui_hook(app)
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/pydev_ipython/inputhook.py", line 195, in enable_qt4
    from pydev_ipython.inputhookqt4 import create_inputhook_qt4
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/pydev_ipython/inputhookqt4.py", line 25, in <module>
    from pydev_ipython.qt_for_kernel import QtCore, QtGui
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/pydev_ipython/qt_for_kernel.py", line 85, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "/Programme/PyCharm/pycharm-community-2016.3.2/helpers/pydev/pydev_ipython/qt_loaders.py", line 281, in load_qt
    api_options))
ImportError: 
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7 or PySide >= 1.0.3 is available,
    and only one is imported per session.
    Currently-imported Qt library:   None
    PyQt4 installed:                 False
    PyQt5 installed:                 True
    PySide >= 1.0.3 installed:       True
    Tried to load:                   ['pyqtdefault']

My search did not help me. I installed

$ sudo apt-get install libqt5svg5*

This question is similar to Setting up IPython Qtconsole with PyQt5 but I am on Linux Kubuntu 14.4. Also, I did not install IPython, but the Jupyter Notebook, but I use PyCharm for development.

Community
  • 1
  • 1
Make42
  • 12,236
  • 24
  • 79
  • 155

1 Answers1

0

I've had similar errors getting the jupyter-notebook to work with PySide. Try pip install PyQt4 (preferably in a virtualenv). I do not believe the jupyter-notebook currently supports Qt5.

wesanyer
  • 982
  • 1
  • 6
  • 27
  • You may wish to update this answer. According to the site, https://matplotlib.org/faq/virtualenv_faq.html Qt5 should be well supported by now. – E_net4 Oct 16 '18 at 17:39