7

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
10
  • 2
    try update pyqt5 and pyqtwebengine: python -m pip install pyqt5 --upgrade Commented Aug 16, 2021 at 7:16
  • TYPO: change self.setCentrealWidget() to self.setCentralWidget(self.browser) Commented Aug 16, 2021 at 7:17
  • @eyllanesc thanks for picking the errors out, I got the code rectified and updated pyqt5 and pyqtwebengine but it still shows the same error. Commented Aug 16, 2021 at 7:48
  • 1
    How did you install pyqtwebengine initially? Did you use pacman? Commented Aug 16, 2021 at 8:02
  • @Daredevil3722 You should use the official pyqt and pyqtwebengine packages provided by your distro. Don't mix and match modules from pip, otherwise you risk running into compatibility issues. If you still get that error with the official packages, you should report it on your distro's issue-tracker as a bug. Commented Aug 16, 2021 at 10:06

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

It's worked for me. Thanks. I was trying install Zscaler and the error was "/opt/zscaler/bin/ZSTray: symbol lookup error: /opt/zscaler/bin/ZSTray"
1

sudo apt install python3-qtpy

fixed it for me

1 Comment

While this code snippet may be the solution, including a detailed explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.