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

WSL2 can't install/find linter #10586

Closed
Stanzilla opened this issue Mar 15, 2020 · 9 comments
Closed

WSL2 can't install/find linter #10586

Stanzilla opened this issue Mar 15, 2020 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@Stanzilla
Copy link

Stanzilla commented Mar 15, 2020

Environment data

  • VS Code version: 1.43
  • Extension version (available under the Extensions sidebar): 2020.2.64397
  • OS and version: Win10 2004
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: XXX
  • Relevant/affected Python-related VS Code extensions and their versions: XXX
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Jedi Disabled
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Linter gets installed

Actual behaviour

Fails to install linter

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Open Python project in WSL

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Interpreter does not exist; analysis will not be available.
There is no Pip installer available in the selected environment.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

Downloading https://pvsc.azureedge.net/python-language-server-stable/Python-Language-Server-linux-x64.0.5.31.nupkg...
Language server download complete
Unpacking archive... done
[Info  - 5:21:35 PM] Analysis cache path: /home/stan/.cache/Microsoft/Python Language Server
[Info  - 5:21:35 PM] Microsoft Python Language Server version 0.5.31.0
[Info  - 5:21:35 PM] Workspace root: /home/stan/projects/work/LuaAPIDocumentation
[Info  - 5:21:36 PM] Interpreter search paths:
[Info  - 5:21:36 PM] User search paths:
[Error - 5:21:36 PM] Unable continue, no builtins module content.
[Error - 5:21:36 PM] Request textDocument/documentSymbol failed.
  Message: Object reference not set to an instance of an object.
  Code: -32000 
   at Microsoft.Python.LanguageServer.Implementation.Server.HierarchicalDocumentSymbol(DocumentSymbolParams params, CancellationToken cancellationToken) in E:\A\_work\3\s\src\LanguageServer\Impl\Implementation\Server.Symbols.cs:line 37
   at Microsoft.Python.LanguageServer.Implementation.LanguageServer.DocumentSymbol(JToken token, CancellationToken cancellationToken) in E:\A\_work\3\s\src\LanguageServer\Impl\LanguageServer.cs:line 226
[Error - 5:24:24 PM] Unable to find document file:///home/stan/projects/work/LuaAPIDocumentation/api_gen/dependencies.py
[Error - 5:25:41 PM] Unable to find document file:///home/stan/projects/work/LuaAPIDocumentation/api_gen/dependencies.py

pip is aliased to pip3 and works fine in the terminal

@Stanzilla Stanzilla added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Mar 15, 2020
@karthiknadig karthiknadig self-assigned this Mar 16, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Mar 16, 2020
@karthiknadig
Copy link
Member

@Stanzilla Can you try and see if python3 -m pip works for the interpreter you are using? The extension uses the pip python module instead of the pip binary. It is likely that the pip module is not available for the selected interpreter.

@karthiknadig karthiknadig added the info-needed Issue requires more information from poster label Mar 18, 2020
@Stanzilla
Copy link
Author

@karthiknadig hey there, thanks for the answer! where would I change which command is used for the interpreter?

@karthiknadig
Copy link
Member

@Stanzilla I meant can you try running python -m pip from the command line for the interpreter you selected. you may have to use the full path to the interpreter.
image

We don't have a way to change this command. I just want to make sure the selected interpreter has the pip module, which is what the extension uses to install.

@Stanzilla
Copy link
Author

Oh okay,

~/projects/work/LuaAPIDocumentation master
❯ python3 -m pip --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

@karthiknadig
Copy link
Member

@Stanzilla Can you share a screenshot with your project open in VSCode?
PS: On windows you can ⊞ Win + Shift + s to get screenshots.

@Stanzilla
Copy link
Author

I think I should clarify where the error occurs. Since VSCode has a WSL mode, it might not have been clear what I meant with "in WSL". In both modes, the files are inside of the WSL VM.

I have a suspicion that my vscode per-repo settings might confuse everything since it sets

"python.pythonPath": "C:\\Users\\Stan\\AppData\\Local\\Microsoft\\WindowsApps\\python.exe"

and probably does not switch to "python.pythonPath": "/usr/bin/python3", when entering WSL mode.

Maybe there should be two settings, like there is for other features, in the form of python.pythonPath.windows/unix/mac

here's a screenshot though

Code_2020-03-18_20-11-47

@karthiknadig
Copy link
Member

@Stanzilla we are doing work to change how we handle the path to interpreter entirely. We will definitely consider this scenario when addressing that.

@karthiknadig
Copy link
Member

Related #10375

@brettcannon brettcannon removed the info-needed Issue requires more information from poster label Apr 23, 2020
@karthiknadig
Copy link
Member

The new setting is now available with the latest version of the extension as a experiment. Add this to your user settings, you will have to enable this in WSL and also in the host, for it to work well between the two.

    "python.experiments.optInto": [
        "DeprecatePythonPath - experiment"
    ]

After this, you will have to select the interpreter once, per workspace. The extension will remember the setting on that machine from then on. There is also a setting to provide a global default interpreter that we will use in case no interpreter is selected. you can set that using

"python.defaultInterpreterPath": "python"

@ghost ghost removed the triage label May 13, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants