question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pylint undefined property error with PyQt5

See original GitHub issue

Pylint 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.

2018-10-08_18-16-58 2018-10-08_18-16-58

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:

  1. Opening a Python file with PyQt5 declarations on a Python Workspace with a selected Python interpreter.

Logs

Output for Python in the Output panel (ViewOutput, 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:closed
  • Created 5 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
angelhdzmultimediacommented, Oct 10, 2018

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! 👍

1reaction
angelhdzmultimediacommented, Oct 9, 2018

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pylint undefined property error with PyQt5 · Issue #2817 - GitHub
Pylinter doesn't find my PyQt5 modules and throws Undefined Property errors. The Python Interpreter works fine and builds the console or GUI ...
Read more >
Errors faced when using PYQT [duplicate] - Stack Overflow
All of the errors are for undefined variables for PyQT related modules. E.G. "Undefined variable 'QApplication' pylint(undefined-variable).
Read more >
Pylint Can't Find Qtcore In Pyqt4 - ADocLib
Pylint undefined property error with PyQt5 Issue #2817 Top Offers From github.com. Update: 1 Uninstalled Python 3.6.4 2 Deleted all related folders.
Read more >
PyQt & PySide: unresolved reference for new-style Signals ...
As in ticket PY-4120 and PY-21068, the issue of marked unresolved reference on new-style connections is still present when subclassing a widget.
Read more >
astroid's ChangeLog — Astroid 2.13.0-dev0 documentation
Handle the effect of properties on the __init__ of a dataclass correctly. Closes PyCQA/pylint#5225. Fix crash if numpy module doesn't have version attribute....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found