DeprecationWarning: sipPyTypeDict() is deprecated PyQt5

10.1k views Asked by At

I was writing the most simplest piece of code to run some small app.

I got the next warning message:

~\PycharmProjects\LoggerTest\main.py:10: DeprecationWarning: sipPyTypeDict() is deprecated, the extension module should use sipPyTypeDictRef() instead
  class MainWindow(QMainWindow):

My code:

# Import libraries
import sys
# from PyQt5 import QtGui
# from PyQt5.QtCore import QEvent
from PyQt5.QtWidgets import QApplication, QMainWindow
# from PyQt5.QtCore import pyqtSignal #, pyqtSlot
from gui_ui import Ui_MainWindow


class MainWindow(QMainWindow):

    def __init__(self, parent=None, **kwargs):
        super(MainWindow, self).__init__(parent=parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    g = MainWindow()
    app.exec_()

What does that warning mean?

2

There are 2 answers

1
Sidonai On BEST ANSWER

It is solved in python-3.12.0

After upgrading, the warning should be away.

Ref: https://github.com/python/cpython/pull/105747

2
sinan özcan On

If you don't want to upgrade your Python version, you can solve the problem by downgrading the PyQt5 module. For my Python 3.7.3 version, I fixed it by downloading PyQt5 version 5.15.4, PyQt5-Qt5 version 5.15.2, and PyQt5-sip version 12.12.1.