Pylint undefined property error with PyQt5
See original GitHub issuePylint throws error of undefined PyQt5 modules (and possible with other modules installed by pip), but when debugging/building the Python app it works fine and I get code hint/auto-complete.
Tried to set the path to the site_packages but no success. Tried to install another version of PyLint but apparently I have the latest one.
Read and read on Google and didn’t find the answer.
Note: I’m not using virtual env.
Environment data
- VS Code version: 1.28.0
- Extension version (available under the Extensions sidebar): 2018.8.0
- OS and version: Windows 10 Professional 64bit 10.0.17134 Build 17134
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.4
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Relevant/affected Python packages and their versions: PyQt5 5.11.2
Actual behavior
Pylinter doesn’t find my PyQt5 modules and throws Undefined Property errors. The Python Interpreter works fine and builds the console or GUI application without errors. Also I get code hint/auto-complete fine.
Having functional python linter which detects all my modules installed by pip.
Steps to reproduce:
- Opening a Python file with PyQt5 declarations on a Python Workspace with a selected Python interpreter.
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
None
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
None
Issue Analytics
- State:
- Created 5 years ago
- Comments:15
Top GitHub Comments
Final Update:
The problem was caused by pylint. I don’t know if pylint itself, or just the version I got (2.1.1). But it was pylint’s fault.
I switched to flake8 in VSCode and all problems gone. Now I have PyQt5 code completion plus functional linting.
Thank you for everything! 👍
Apparently, Python and pylint are installed in C:/, but PyQt5 is installed in User/AppData/Roaming/python/python36/site-packages
I don’t know how this happened because I always install python globally on C:/
That’s why pylint doesn’t find pyqt I’m pretty sure. Please confirm this.
I’ll probably end telling myself “silly me!” and embarrased for wasting your time!