Results 1 to 2 of 2

Thread: PyQt5 - No module named PyQt5.QtWidgets

  1. #1
    Join Date
    Jan 2008
    Location
    UK
    Beans
    75
    Distro
    Ubuntu 15.04 Vivid Vervet

    Question PyQt5 - No module named PyQt5.QtWidgets

    Good Evening,

    I am running Ubuntu 15.04 and I have installed Qt Creator from the Ubuntu Software Centre. I am trying to run a small Python script to show a Window:

    Code:
    import sys
    from PyQt5.QtWidgets import QApplication, QDialog
    from ui_imagedialog import Ui_ImageDialog
    
    app = QApplication(sys.argv)
    window = QDialog()
    ui = Ui_ImageDialog()
    ui.setupUi(window)
    
    window.show()
    sys.exit(app.exec_())
    but I get the following error:

    Traceback (most recent call last):
    File "ui.py", line 2, in <module>
    from PyQt5.QtWidgets import QApplication, QDialog
    ImportError: No module named PyQt5.QtWidgets
    I am unsure why this is, please can you help?

    Thanks,

  2. #2
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: PyQt5 - No module named PyQt5.QtWidgets

    You will get that error if pyqt5 isn't installed. So install either the python-pyqt5 or python3-pyqt5 package depending on which python version you are using.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •