Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylint does not work. #12285

Closed
zhouwangyang opened this issue Jun 11, 2020 · 13 comments
Closed

Pylint does not work. #12285

zhouwangyang opened this issue Jun 11, 2020 · 13 comments
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. area-linting bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@zhouwangyang
Copy link

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

@zhouwangyang zhouwangyang added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 11, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 11, 2020
@kimadeline
Copy link

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?

@kimadeline kimadeline added the info-needed Issue requires more information from poster label Jun 11, 2020
@plushchaynikolay
Copy link

plushchaynikolay commented Jun 16, 2020

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.

@silvestriluca
Copy link

silvestriluca commented Jun 18, 2020

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:

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.

@zhouwangyang
Copy link
Author

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

@silvestriluca
Copy link

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

@jeremyd2019
Copy link

See #7314

I think I found the issue...

const inspection = configuration.inspect<boolean>(this.enabledSettingName);

I think should be `linting.${this.enabledSettingName}` like

return this.configService.updateSetting(`linting.${this.enabledSettingName}`, enabled, resource);

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

@kimadeline
Copy link

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

Thank you all for your patience!

@kimadeline kimadeline added area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. area-linting needs PR regression Bug didn't exist in a previous release and removed info-needed Issue requires more information from poster triage labels Jun 19, 2020
@johntmyers
Copy link

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

@johntmyers
Copy link

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

@kimadeline
Copy link

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.

@silvestriluca
Copy link

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.

@kimadeline
Copy link

kimadeline commented Jun 25, 2020

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

@ghost ghost removed the needs PR label Jun 25, 2020
@CodePint
Copy link

CodePint commented Jul 6, 2020

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"
}

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. area-linting bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

8 participants