Search code examples
pythonqtquick2

ModuleNotFoundError: No module named 'PySide6' in QT Quick


I have problem that everything works perfectly in Visual Studio Code, but in QT Quick im still getting an error:

Traceback (most recent call last):
  File "D:\python\qt\kurs1\main.py", line 5, in <module>
    from PySide6.QtGui import QGuiApplication
ModuleNotFoundError: No module named 'PySide6'

What can be caused of this error? How to fix it?


Solution

  • Is it possible that the module PySide6 is not appended to the sys path? Or is the module in the folder the main.py it is getting launched? Try to use

    sys.path.append('/path/to/application/app/folder')
    

    to be sure that module will be reachable at right time. That should solve your issue in my opinion. (as you mentioned in the comment that module is already installed for your python --> pip install module)

    Hi Szymon, let's try a possible solution....step by step from me :-)

    Open CMD (command line from windows) and go to that path you have: cd 'C:\\Users\\szymo\\AppData\\Local\\Programs\\Python\\Python312'

    Then go to "Scripts" folder with command --> cd Scripts

    Then write --> pip install PySide6

    That will either tell you already installed, or will install for the python version you are using in your program :-) As per output you have above, that module will be now found :-)