RuntimeError: the sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3

Question:

I recently installed PyQt4 onto my system and started doing some basic tasks (course work), it worked fine.

Then, after some days, I was trying to work with matplotlib.

When I tried import matplotlib.pyplot as plt,I get the following error:

Traceback (most recent call last):
  File "C:UsersuserDesktopConfusion.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibpyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibbackends__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibbackendsbackend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibbackendsbackend_qt5.py", line 27, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibbackendsqt_editorfigureoptions.py", line 17, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibbackendsqt_editorformlayout.py", line 58, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "C:Program FilesAnaconda3libsite-packagesmatplotlibbackendsqt_compat.py", line 127, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
RuntimeError: the sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3
[Finished in 1.9s]

I thought that the problem is with the installation of PyQt4 while I already had PyQt5, but thiswebsite says that they can work properly together without any problem, provided the sip is of same version for both.

The problem seems to be coming from sip.

I followed the steps given here : PyQt5 – SIP API 10 level error. API 11 required

  1. When I run import sip and then
    print(sip, sip.SIP_VERSION_STR)

    I get the following:

    4.16.9

  2. Then when I run sip -V in the command prompt, I get 4.18.

I clearly see that there is in the sip module.

All I want to ask is, how do I solve this problem?

I am on a Windows 8 64 bit system, using Anaconda3

Any help is appreciated. 🙂

Asked By: Pragyaditya Das

||

Answers:

The problem was solved by doing a pip install pyqt5 and the sip version became same.

I followed this website : PyQt Sourceforge.

I hope this helps.

Answered By: Pragyaditya Das

I had the same problem, and upgrading sip through conda worked for me:

conda upgrade sip
Answered By: MonkeyGenius

I have the same problem. And I fixed it temporarily by :
try import PyQt4 or import PyQt5 before import matplotlib.pyplot as plt

Answered By: Shao-han Jiang

You have to update the PyQt5-sip package as well:

pip install PyQt5-sip --upgrade
Answered By: Rabbid76