Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Module not found PyQt6
QtWS25 Last Chance

Module not found PyQt6

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 2 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikeb888
    wrote on last edited by mikeb888
    #1

    I am using Python 3.10 and have installed PyQt6 using "pip install PyQt6" on Linux Mint 22.

    It has been installed in /usr/local/lib/python3.10/dist-packages/PyQt6/bindings/QtWidgets/ for example.

    Various Internet pages say it should be installed in "site-packages". That is not true for me.

    When I use the following:

    from PyQt6.QtWidgets import (QApplication, QWidget, QVBoxLayout, QPushButton,
    						 QTextEdit, QTreeWidget, QTreeWidgetItem, QScrollArea)
    from PyQt6.QtCore import Qt
    

    I receive the following error: "ModuleNotFoundError: No module named 'PyQt6'"

    How do I get the module to load?

    Is there an ENV variable I need to set?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mikeb888
      wrote on last edited by
      #2

      The above was incorrect as I am running Python 3.12.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Are you sure you started the correct version of Python ?
        The installation is clearly 3.10 but if you start a 3.12 interpreter then it won't work.

        The best way to develop a project in Python is to use virtual environments.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mikeb888
          wrote on last edited by
          #4

          Python3 points at 3.12 even though 3.10 is also installed.

          I have used docker in the past, but not venv, virtualenv or Conda as of yet. Do you have a preference as to which is best to use?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Then explicitly call the version of Python you want to use when executing your script.

            As for conda VS venv, it highly depends on your goal.
            You might also want to consider using something like uv that will help you manage your dependencies and environnement.

            Since you are starting fresh, I would recommend testing uv.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved