Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'PySide6' in Python using Visual Studio Code [duplicate]

I installed PySide6 on my MacBook and confirmed that it is installed as shown in the attached screen shot.

pip3 install PySide6

screenshot of Finder on the PySide6 folder

I tried to run this simple app from Visual Studio Code:

from PySide6.QtWidgets import QApplication,QLabel
app   = QApplication([])
label = QLabel('hello world')
label.show()
app.exec()

Python responded with this error:

Traceback (most recent call last):
  File "/Users/emad-ud-deen/Development/Python/Practice/PySide6 Test.py", line 1, in <module>
    from PySide6.QtWidgets import QApplication,QLabel
ModuleNotFoundError: No module named 'PySide6'

The only way I'm able to run the apps I write with PySide6 without that error is from the command line in Terminal.

Can you tell me how to get Visual Studio Code to recognise PySide6?

like image 995
Emad-ud-deen Avatar asked May 24 '26 18:05

Emad-ud-deen


1 Answers

I have the same question with you, but I've just found a solution:

You can use command like this:

pip uninstall pyside6-addons
pip uninstall pyside6-essentials
pip uninstall pyside6
pip install pyside6-essentials

Actually, if you don't want to use so difficult plugins, just install PySide6-Essentials[1] is benefit for you :)

References:

[1] https://www.qt.io/blog/qt-for-python-details-on-the-new-6.3-release

like image 119
whitroom Avatar answered May 27 '26 08:05

whitroom