Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

This "unresolved import" warning is displayed when using the "Microsoft" language service. #2118

Open
Jill-Cheng opened this issue Sep 9, 2020 · 3 comments

Comments

@Jill-Cheng
Copy link

Environment data

  • VS Code version: 1.48.2 (user setup)

  • Extension version (available under the Extensions sidebar): 2020.8.106424

  • OS and version: Windows_NT x64 10.0.18362

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.3 from Anaconda/python3.8.3

  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv | conda

  • Relevant/affected Python packages and their versions: N/A

  • Relevant/affected Python-related VS Code extensions and their versions: Pylance 2020.8.3

  • Value of the python.languageServer setting: "python.languageServer": "Microsoft",

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

When using the "Microsoft" language service, VSCode does not display this "unresolved import" warning.

Actual behaviour

When using the "Microsoft" language service, VSCode displays this "unresolved import" warning.

Steps to reproduce:

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

  1. In the same parent folder, import the class of the "b.py" file in the "a.py" file.
  2. When using the "Microsoft" language service, VSCode displays this "unresolved import" warning.
  3. When using "Pylance" or "Jedi" language services, VSCode does not display this "unresolved import" warning.
  4. When using "Microsoft" language service, and set "python.analysis.disabled": [
    "unresolved-import"
    ], VSCode does not display this "unresolved import" warning.

Is it possible to prevent VSCode from displaying this warning like "Pylance" and "Jedi" without setting it?

Logs

User belongs to experiment group 'AlwaysDisplayTestExplorer - experiment' User belongs to experiment group 'ShowPlayIcon - start' User belongs to experiment group 'DebugAdapterFactory - experiment' User belongs to experiment group 'PtvsdWheels37 - experiment' User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control' User belongs to experiment group 'LocalZMQKernel - experiment' User belongs to experiment group 'CollectLSRequestTiming - control' User belongs to experiment group 'CollectNodeLSRequestTiming - experiment' User belongs to experiment group 'EnableIPyWidgets - experiment' User belongs to experiment group 'DeprecatePythonPath - experiment' User belongs to experiment group 'RunByLine - control' User belongs to experiment group 'CustomEditorSupport - control' User belongs to experiment group 'pythonaacf' > conda --version > pyenv root > python3.7 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python3.6 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python3 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python2 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -3.7 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -3.6 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -3 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -2 c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > D:\Users\...\Anaconda3\envs\jhgjghjgLine\python.exe c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" Error 2020-09-09 16:22:20: Detection of Python Interpreter for Command python3 and args failed as file does not exist Python interpreter path: D:\Users\...\AppData\Local\Programs\Python\Python38\python.exe Starting Microsoft Python language server. > conda info --json > conda info --json > conda info --json > conda env list Error 2020-09-09 16:22:20: Detection of Python Interpreter for Command py and args -2 failed as file Python 2 not found!

-3.8-64
-3.7-64
-3.5-64 does not exist
Error 2020-09-09 16:22:20: Detection of Python Interpreter for Command py and args -3.6 failed as file Python 3.6 not found!

-3.8-64
-3.7-64
-3.5-64 does not exist
Error 2020-09-09 16:22:20: Failed to download and store experiments, Class name = b, completed in 1822ms, has a falsy return value, , Return Value: undefined [Error: Failed with status 404, Not Found, Uri https://raw.githubusercontent.com/microsoft/vscode-python/master/experiments.json
at H._callback (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\extension.js:54:713175)
at H.a._callback.a.callback.a.callback (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\node_modules\request.js:189:5442)
at H.emit (events.js:203:13)
at H. (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\node_modules\request.js:189:18302)
at H.emit (events.js:203:13)
at IncomingMessage. (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\node_modules\request.js:189:17134)
at Object.onceWrapper (events.js:291:20)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11)]
Error 2020-09-09 16:22:20: Failed to initialize experiments, Class name = b, completed in 1835ms, has a falsy return value, , Return Value: undefined [Error: Failed with status 404, Not Found, Uri https://raw.githubusercontent.com/microsoft/vscode-python/master/experiments.json
at H._callback (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\extension.js:54:713175)
at H.a._callback.a.callback.a.callback (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\node_modules\request.js:189:5442)
at H.emit (events.js:203:13)
at H. (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\node_modules\request.js:189:18302)
at H.emit (events.js:203:13)
at IncomingMessage. (c:\Users....vscode\extensions\ms-python.python-2020.8.106424\out\client\node_modules\request.js:189:17134)
at Object.onceWrapper (events.js:291:20)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11)]
Error 2020-09-09 16:22:20: Failed to get interpreter information for 'C:\Users...\AppData\Local\Microsoft\WindowsApps\python.exe' [Error: Command failed: "C:\Users...\AppData\Local\Microsoft\WindowsApps\python.exe" "c:\Users....vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py" "c:\Users....vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\interpreterInfo.py"
Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:203:13)
at maybeClose (internal/child_process.js:1021:16)
at Socket. (internal/child_process.js:430:11)
at Socket.emit (events.js:203:13)
at Pipe. (net.js:588:12)] {
killed: false,
code: 9009,
signal: null,
cmd: '"C:\\Users\...\AppData\Local\Microsoft\WindowsApps\python.exe" "c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py" "c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\interpreterInfo.py"'
}
Error 2020-09-09 16:22:20: Failed to get interpreter information for 'C:\Users...\AppData\Local\Microsoft\WindowsApps\python3.exe' [Error: Command failed: "C:\Users...\AppData\Local\Microsoft\WindowsApps\python3.exe" "c:\Users....vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py" "c:\Users....vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\interpreterInfo.py"
Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:203:13)
at maybeClose (internal/child_process.js:1021:16)
at Socket. (internal/child_process.js:430:11)
at Socket.emit (events.js:203:13)
at Pipe. (net.js:588:12)] {
killed: false,
code: 9009,
signal: null,
cmd: '"C:\\Users\...\AppData\Local\Microsoft\WindowsApps\python3.exe" "c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\pyvsc-run-isolated.py" "c:\Users\...\.vscode\extensions\ms-python.python-2020.8.106424\pythonFiles\interpreterInfo.py"'
}

conda env list

@karthiknadig
Copy link
Member

@jill123-cc Pylance will eventually replace Microsoft Language server. Currently all of our development efforts have moved over to pylance. Since you mentioned that this is working with pylance, please use that. If you run into issues please file bugs on the pylance repo: https://github.com/microsoft/pylance-release

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Sep 9, 2020
@MikhailArkhipov
Copy link

See also https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#unresolved-import-warnings

@Jill-Cheng
Copy link
Author

@karthiknadig @MikhailArkhipov Thank you very much for your reply!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants