Andreas Schwab Andreas Schwab - 11 months ago 254
Python Question

How do I configure Visual Studio Code with Python extension to not complain about inability to import modules?

I am new to VS Code and I installed e.g. PySide for my tutorial project written in Python. I try to:

from PySide.QtGui import QDialog, QApplication, QVBoxLayout, QLineEdit, QTextBrowser
from PySide.QtCore import *

Although the code runs perfectly well using the imported modules, VS Code complains with:

[pylint] E0401:Unable to import 'PySide.QtGui'


[pylint] E0401:Unable to import 'PySide.QtCore'

This is very irritating, since I am able to use the modules as expected. I would guess an configuration issue, but do not know how to fix this.

Thank you very much.

See also:

Visual representation of VS Code complaining


I use a precompiled version of PySide. Could this be the reason for this behaviour?

Don Don
Answer Source

@Andreas Schwab, You need to ensure pylint is installed in the python environment in which you have installed the PySide package. You will also need to ensure this same environment (python interpreter) is referenced in settings.json in the python.pythonPath setting.

You can find more details on these two here: