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

Python extension is showing "Pylance is not installed" notification too soon #16614

Closed
luabud opened this issue Jul 5, 2021 · 6 comments
Closed
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority needs proposal Need to make some design decisions

Comments

@luabud
Copy link
Member

luabud commented Jul 5, 2021

Environment data

  • VS Code version: 1.58.0-insider (Codespaces, Edge)
  • Extension version (available under the Extensions sidebar): 2021.7.992362372-dev
  • OS and version: Windows 10
  • Relevant/affected Python-related VS Code extensions and their versions: Pylance 2021.6.3
  • Value of the python.languageServer setting: Pylance

[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]

We used to have a race condition when installing the Python extension that caused multiple notifications to show up with "Cannot install X because it depends on the Python extension and its not installed". That was fixed with a reload, but the UX isn't great. VS Code fixed the problem (microsoft/vscode#124870), so now it's showing on our end (with many more notifications if you open it in Codespaces using VS Code insiders 😅)

image

The problem seems to be that we activate while Pylance is still installing, so we show the notification that it's not installed. Once it finishes installing, we ask users to reload it. Not sure what would be the best way to handle this case but we could wait a bit before we show that Pylance is not installed yet?

cc @jakebailey @savannahostrowski

Steps to reproduce:

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

I can reproduce it every time that I create a new codespace using a Python repo and open a Python file to activate the Python extension. But it should also be reproduceable if you set "Pylance" in the user setting scope, uninstall the Python, Jupyter and Pylance extensions, reload the window, install the Python extension and activate it by opening a Python file.

Logs

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

> pyenv root
> conda --version
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> /opt/python/latest/bin/python -c "import sys;print(sys.executable)"
> pyenv root
> conda info --json
Python interpreter path: /opt/python/latest/bin/python
Starting download for Insiders build.
Downloading https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix...
Error 2021-07-05 23:10:08: Failed to check if file needs to be fixed EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://codespaces+luabud-hello-vscodespaces-57r5w7pw2v5rr/home/codespace/.config/Code - Insiders/User/settings.json' (Error: Unable to resolve non-existing file 'vscode-remote://codespaces+luabud-hello-vscodespaces-57r5w7pw2v5rr/home/codespace/.config/Code - Insiders/User/settings.json')
    at _handleError (/vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/out/vs/server/remoteExtensionHostProcess.js:84:167834)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at y.readText (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:9:343940)
    at p.doesFileNeedToBeFixed (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:581700)
    at /home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:580827
    at async Promise.all (index 0)
    at p.getFilesToBeFixed (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:580773)
    at p.updateTestSettings (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:580400) {
  code: 'FileNotFound'
}
Error 2021-07-05 23:10:08: Failed to check if file needs to be fixed EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://codespaces+luabud-hello-vscodespaces-57r5w7pw2v5rr/workspaces/hello-vscodespaces/.vscode/settings.json' (Error: Unable to resolve non-existing file 'vscode-remote://codespaces+luabud-hello-vscodespaces-57r5w7pw2v5rr/workspaces/hello-vscodespaces/.vscode/settings.json')
    at _handleError (/vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/out/vs/server/remoteExtensionHostProcess.js:84:167834)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at y.readText (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:9:343940)
    at p.doesFileNeedToBeFixed (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:581700)
    at /home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:580827
    at async Promise.all (index 1)
    at p.getFilesToBeFixed (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:580773)
    at p.updateTestSettings (/home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension.js:59:580400) {
  code: 'FileNotFound'
}
> pyenv root
> pyenv root
> pyenv root
Starting Pylance language server.
> conda env list
> /usr/local/py-utils/bin/pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /workspaces/hello-vscodespaces/app.py
cwd: /workspaces/hello-vscodespaces
Insiders build download complete.
Installing Insiders... ##########Linting Output - pylint##########
************* Module app
1,0,error,import-error:Unable to import 'flask'

------------------------------------
Your code has been rated at -2.50/10

complete.
> pyenv root

Log (Remote Extension host)

[2021-07-05 23:09:59.101] [exthost] [info] extension host started
[2021-07-05 23:09:59.111] [exthost] [info] Lock '/home/codespace/.vscode-remote/data/User/workspaceStorage/54f44a91/vscode.lock': Lock acquired.
[2021-07-05 23:09:59.167] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"}
[2021-07-05 23:09:59.167] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/microsoft-authentication/dist/extension.js
[2021-07-05 23:09:59.191] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"}
[2021-07-05 23:09:59.191] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/debug-auto-launch/dist/extension
[2021-07-05 23:09:59.199] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-07-05 23:09:59.199] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/git/dist/main
[2021-07-05 23:09:59.263] [exthost] [info] ExtensionService#_doActivateExtension GitHub.codespaces {"startup":true,"extensionId":{"value":"GitHub.codespaces","_lower":"github.codespaces"},"activationEvent":"*"}
[2021-07-05 23:09:59.263] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/codespace/.vscode-remote/extensions/github.codespaces-0.10.8/out/bundle/extension-node.js
[2021-07-05 23:09:59.461] [exthost] [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github {"startup":true,"extensionId":{"value":"GitHub.vscode-pull-request-github","_lower":"github.vscode-pull-request-github"},"activationEvent":"*"}
[2021-07-05 23:09:59.462] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/codespace/.vscode-remote/extensions/github.vscode-pull-request-github-0.27.1/dist/extension
[2021-07-05 23:10:00.074] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"}
[2021-07-05 23:10:00.074] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/github-authentication/dist/extension.js
[2021-07-05 23:10:00.275] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"}
[2021-07-05 23:10:00.276] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/ms-vscode.js-debug/src/extension.js
[2021-07-05 23:10:00.644] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":false,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-07-05 23:10:00.644] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/github/dist/extension.js
[2021-07-05 23:10:01.773] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":false,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"onStartupFinished"}
[2021-07-05 23:10:01.773] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/emmet/dist/node/emmetNodeMain
[2021-07-05 23:10:01.821] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":false,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"onStartupFinished"}
[2021-07-05 23:10:01.821] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/merge-conflict/dist/mergeConflictMain
[2021-07-05 23:10:01.825] [exthost] [info] ExtensionService#_doActivateExtension vscode.testing-editor-contributions {"startup":false,"extensionId":{"value":"vscode.testing-editor-contributions","_lower":"vscode.testing-editor-contributions"},"activationEvent":"onStartupFinished"}
[2021-07-05 23:10:01.825] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/testing-editor-contributions/dist/extension.js
[2021-07-05 23:10:01.826] [exthost] [info] eager extensions activated
[2021-07-05 23:10:03.266] [exthost] [info] ExtensionService#_doActivateExtension ms-toolsai.jupyter {"startup":false,"extensionId":{"value":"ms-toolsai.jupyter","_lower":"ms-toolsai.jupyter"},"activationEvent":"onLanguage:python"}
[2021-07-05 23:10:03.266] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/codespace/.vscode-remote/extensions/ms-toolsai.jupyter-2021.8.1000539794/out/client/extension
[2021-07-05 23:10:04.430] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing {"startup":false,"extensionId":{"value":"vscode.configuration-editing","_lower":"vscode.configuration-editing"},"activationEvent":"onLanguage:jsonc"}
[2021-07-05 23:10:04.430] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/configuration-editing/dist/configurationEditingMain
[2021-07-05 23:10:04.434] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features {"startup":false,"extensionId":{"value":"vscode.json-language-features","_lower":"vscode.json-language-features"},"activationEvent":"onLanguage:jsonc"}
[2021-07-05 23:10:04.434] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/json-language-features/client/dist/node/jsonClientMain
[2021-07-05 23:10:04.483] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features {"startup":false,"extensionId":{"value":"vscode.typescript-language-features","_lower":"vscode.typescript-language-features"},"activationEvent":"onLanguage:jsonc"}
[2021-07-05 23:10:04.483] [exthost] [info] ExtensionService#loadCommonJSModule file:///vscode/bin/x64/1db97b8c87fb32aa47b58135832733f4950362b4-insider/extensions/typescript-language-features/dist/extension
[2021-07-05 23:10:06.153] [exthost] [info] ExtensionService#_doActivateExtension ms-python.python {"startup":false,"extensionId":{"value":"ms-toolsai.jupyter","_lower":"ms-toolsai.jupyter"},"activationEvent":"api"}
[2021-07-05 23:10:06.153] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/codespace/.vscode-remote/extensions/ms-python.python-2021.6.944021595/out/client/extension
[2021-07-05 23:10:11.503] [exthost] [info] ExtensionService#_doActivateExtension ms-python.vscode-pylance {"startup":false,"extensionId":{"value":"ms-python.vscode-pylance","_lower":"ms-python.vscode-pylance"},"activationEvent":"onLanguage:python"}
[2021-07-05 23:10:11.503] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/codespace/.vscode-remote/extensions/ms-python.vscode-pylance-2021.6.3/dist/extension.bundle.js

@luabud luabud added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team important Issue identified as high-priority labels Jul 5, 2021
@jakebailey
Copy link
Member

jakebailey commented Jul 6, 2021

It seems like the current state is much, much worse than before. Now Pylance isn't even available to be activated so the Python extension can use it. I am very surprised that it's letting extensions activate during installs of the dependency chains, but I suppose that the directions currently (to VS Code's eyes) are "Python soft requires Pylance" and "Pylance hard requires Python", where installing the Python extension first is the way to do it. But, we want them both to be activated together as one unit, just distributed separately.

I'd wonder if we should have just dropped the hard dep from Pylance to Python, but if VS Code is now activating Python before any of its extension pack / optional deps are installed, then there's not much we can do to fix this and we're going to regress majorly.

This later check is "fixable" with a sleep to maybe wait for the install to complete, but the check that makes "Default" be Pylance is much earlier, and we'd have to somehow block the Python extension activation until Pylance has been installed. Except for both cases, we can't know that it is currently being installed from the APIs (maybe it's not even being installed at all because it was explicitly uninstalled!).

@sandy081

@karthiknadig karthiknadig added needs proposal Need to make some design decisions and removed triage-needed Needs assignment to the proper sub-team labels Jul 6, 2021
@karthiknadig karthiknadig added the area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. label Jul 6, 2021
@jakebailey
Copy link
Member

Any idea when the next VS Code release is datewise so we can go verify that this is definitely broken?

@rzhao271
Copy link

rzhao271 commented Jul 6, 2021

The next VS Code Stable release should be this Thursday.

@jakebailey
Copy link
Member

I've just tested on insiders, and it's unfortunately broken, it seems.

image

I get this one only, but it's likely that's because I uninstalled and reinstalled and things were cached (so were fast).

@jakebailey
Copy link
Member

FWIW this is our main install flow for all Python users, so any new user is going to start seeing these in the next VS Code update, hence me asking for timing.

@luabud
Copy link
Member Author

luabud commented Jul 7, 2021

Fixed upstream by microsoft/vscode#128088.

@luabud luabud closed this as completed Jul 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 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. bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests

5 participants