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
When I run import sip
and then
print(sip, sip.SIP_VERSION_STR)
I get the following: 4.16.9
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. :)
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.