Emad-ud-deen
Emad-ud-deen

Reputation: 4864

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

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?

Upvotes: 9

Views: 28339

Answers (2)

Art
Art

Reputation: 1

I've just fixed this problem on PyCharm by going into Settiings->Project->Python Interpreter->press '+' button then write what do you need to install.

When I tried to do installing by using pip install it was not working at all

Upvotes: 0

whitroom
whitroom

Reputation: 67

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

Upvotes: 7

Related Questions