Vscode-python: Pylint does not work.

Created on 11 Jun 2020  路  13Comments  路  Source: microsoft/vscode-python

Make sure pylint does not install in the environment.
repro step:
1.Open folder Tester in vsc
2.Add new file test.py and typing code
msg='Hello Python'
print msg
3.Ctrl + shift + P to open command palette, Run Python: Run Select Linter command, then select pylint in the download list
expect result
Prompting to install Pylint

Actual result
After select run pylint, there is no any response.
no any output in output Python window.

Extension version: 2020.7.86945-dev
VS Code version: Code - Insiders 1.47.0-insider

P0 area-intellisense area-linting reason-regression type-bug

Most helpful comment

Actually pylint support (under venv in my case) has been broken with 2020.6.0 release.

TL;DR:

Possible source of the issue is the following fix:

  • Removed python.jediEnabled setting in favor of python.languageServer. Instead of "python.jediEnabled": true please use "python.languageServer": "Jedi".
    (#7010)

Quick workaround:

Jedi seems to work fine with pylint, so use the following .vscode/settings.json to force it explicitly:

{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Jedi"
}

Long explanation:

  • Microsoft Python Language Server and pylint seems to be a problematic combination in vscode-python extension. According to this, Microsoft Python Language Server doesn't run Pylint, so it's an integration issue in the extension.
  • Before 2020.6.0 , python.jediEnabled' was assumed true when not explicitly specified
  • With 2020.6.0 python.jediEnabled' has been eliminated and the language server defaults to "Microsoft"
  • 2020.6.0 prompts for an explicit entry of "python.languageServer": "Microsoft" in User settings, modiying the User settings if accepted.
  • 2020.6.0 settings for workspace is not really consistent to what happens when "python.languageServer" is not specified in .vscode/settings.json, as it assumes that "Jedi" is default, while "Microsoft" is the actual default. => possible bug ??
  • Because of that, in a default configuration with a venv activated, Microsoft language server is active with all the consequences reagarding issues with pylint => pylint stops to work properly in the IDE.
  • Forcing Jedi with "python.languageServer": "Jedi" in .vscode/settings.json (a.k.a. Workspace setting) is a workaround to have pylint working again.

All 13 comments

Hi @zhouwangyang,

Does the extension activate between step 2 and step 3? If it does there should be some output in the Python window, can you copy it? Or does the extension not get activated at all?

Met the same issue:

  1. Pylint is not installed.
  2. Open folder in VSC
  3. Add file test.py (and typed incorrect code to check linter works)
  4. Ctrl + Shift + P for command palette
  5. Run Python: Run Select Linter
  6. Select pylint

Expected result
Prompting to install Pylint

Actual result
After select pylint, there is no any response and no any output in Python window.

If pylint is installed, it only works from command line, but doesn't lint errors in VSC.

Python extension version: v2020.7.86945-dev
VSCode-Insiders version: 1.47.0-insider
Pylint version: 2.5.2

When tried to select flake8 (also not installed), printed:

Linter 'flake8' is not installed. Please install it or select another linter".
Error: Module 'flake8' not installed.

and showed notification, as expected. So, it occurs just with pylint.
Also flake8 works just fine.

Actually pylint support (under venv in my case) has been broken with 2020.6.0 release.

TL;DR:

Possible source of the issue is the following fix:

  • Removed python.jediEnabled setting in favor of python.languageServer. Instead of "python.jediEnabled": true please use "python.languageServer": "Jedi".
    (#7010)

Quick workaround:

Jedi seems to work fine with pylint, so use the following .vscode/settings.json to force it explicitly:

{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Jedi"
}

Long explanation:

  • Microsoft Python Language Server and pylint seems to be a problematic combination in vscode-python extension. According to this, Microsoft Python Language Server doesn't run Pylint, so it's an integration issue in the extension.
  • Before 2020.6.0 , python.jediEnabled' was assumed true when not explicitly specified
  • With 2020.6.0 python.jediEnabled' has been eliminated and the language server defaults to "Microsoft"
  • 2020.6.0 prompts for an explicit entry of "python.languageServer": "Microsoft" in User settings, modiying the User settings if accepted.
  • 2020.6.0 settings for workspace is not really consistent to what happens when "python.languageServer" is not specified in .vscode/settings.json, as it assumes that "Jedi" is default, while "Microsoft" is the actual default. => possible bug ??
  • Because of that, in a default configuration with a venv activated, Microsoft language server is active with all the consequences reagarding issues with pylint => pylint stops to work properly in the IDE.
  • Forcing Jedi with "python.languageServer": "Jedi" in .vscode/settings.json (a.k.a. Workspace setting) is a workaround to have pylint working again.

@kimadeline The extension is active, and the output is all the operation information before I click Pylint. After I select Pylint, there is no output in output window.

Should we consolidate Pylint + Ms Python Language Server integration related issues under a single issue ticket? My impression is that they are somehow related.

See #7314

I think I found the issue...
https://github.com/microsoft/vscode-python/blob/19bb7dfdf3b9be7394bbf10c2481992eff3dd90f/src/client/linters/linterInfo.ts#L102

I think should be `linting.${this.enabledSettingName}` like
https://github.com/microsoft/vscode-python/blob/19bb7dfdf3b9be7394bbf10c2481992eff3dd90f/src/client/linters/linterInfo.ts#L50

If I set 'python.pylintEnabled': true in my settings, it works with the Microsoft Language Server.

Good catch @jeremyd2019 ! We'll get on that right away 馃捇

Thank you all for your patience!

This is happening for me in Version: 1.46.1. Is it supposed to work for this version?

Just switched back to Jedi and now pylint works in 1.46.1.

Hi @johntmyers, we fixed that bug recently and it should be available in the next stable release of the extension. You can also download the Insiders version of the extension if you would rather not wait for the next release.

Version v2020.6.90262 fixed the issue for me.

Pylint now works also with the following configuration:

{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Microsoft"
}

Kudos @kimadeline for the quick bugfix release.

Thank you for reporting back that it works now @silvestriluca! Closing as resolved.

A note in the docs would not go amiss until a fix is released: https://code.visualstudio.com/docs/python/linting
I spent a fair amount of time trying to debug my config before coming across this issue.

specifying the language server fixes the bug for me as well.

{
    "python.languageServer": "Microsoft"
}
Was this page helpful?
0 / 5 - 0 ratings