Import error with PyQt5 : undefined symbol:_ZNSt12out_of_rangeC1EPKc,versionQt_5

Viewed 1924

I had watched a video on YouTube about making your own web browser using PyQt5. Link to video: https://youtu.be/z-5bZ8EoKu4, I found it interesting and decided to try it out on my system. Please note that I am using a derivative of Arch Linux (Garuda). Here's the code:

import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *


class MainWindow(QMainWindow) :
    def __init__(self):
        super(MainWindow, self).__init__()
        self.browser = QWebEngineView()
        self.browser.setUrl(QUrl('http://google.com'))
        self.setCentrealWidget()
        self.showMaximized()


app = QApplication(sys.argv)
QApplication.setApplicationName('Chrome Killer')
window = MainWindow()
app.exec_()

Unfortunately, I encountered an error with imports. I tried reading the documentation and surfed forums but returned empty-handed.

Traceback (most recent call last):
  File "/home/tanishq/Tanishq/VS Code/Own Browser/main.py", line 4, in <module>
    from PyQt5.QtWebEngineWidgets import *
ImportError: /home/tanishq/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib/libQt5WebEngineCore.so.5: undefined symbol: _ZNSt12out_of_rangeC1EPKc, version Qt_5

Other relevant details:

  • Python version: 3.9.6
  • PyQt5 version: 5.15.2
1 Answers

I got the code working...I had just run two commands

firstly:

sudo pip uninstall pyqt5

and the last command:

sudo pacman -S pyqt5

thank you @eyllanesc and @ekhumoro for your help

Related