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

4

12

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:\Users\user\Desktop\Confusion.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 114, 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 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 27, 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 17, 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 58, 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 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. :)

Waterless answered 20/10, 2016 at 16:4 Comment(0)
W
4

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.

Waterless answered 20/10, 2016 at 16:21 Comment(2)
Ehi Pragyaditya! pip install pyqt5 does not work for me. Can you imagine why? I have python 2.7.11Utley
Can you post the exact error message? And also consider asking a fresh question; notify me here. I will do my best to answer.Waterless
P
7

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

pip install PyQt5-sip --upgrade
Perverted answered 12/12, 2021 at 16:59 Comment(1)
This works!! :)Ave
W
4

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.

Waterless answered 20/10, 2016 at 16:21 Comment(2)
Ehi Pragyaditya! pip install pyqt5 does not work for me. Can you imagine why? I have python 2.7.11Utley
Can you post the exact error message? And also consider asking a fresh question; notify me here. I will do my best to answer.Waterless
T
2

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

conda upgrade sip
Trousers answered 24/8, 2017 at 13:20 Comment(0)
I
0

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

Incorporating answered 3/5, 2018 at 3:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.