You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 2020.8.101144 has many bugs, downgrade it to the one below it and everything should be fine. I issued a bug where the terminal would not accept any keyboard inputs and took me so long to realize what happened and its because python has a very recent update and downgrading it worked.
Does this behaviour happen consistently, and would yousefabuz17 downgrading suggestion work as a workaround for now?
I couldn't reproduce your issue on macOS 10.15.6, VS Code 1.48.0 and the Python extension 2020.8.101144, what is the value of the python.languageServer setting in your user settings?
Hi Kim-Adeline Miguel (@kimadeline) , I can constantly reproduce this issue: firstly add multiple folders to a workspace, open a file in one folder, then switch to a file from another folder(it is the key point), then an error occurs:
Error 2020-09-23 17:04:23: Failed to activate a workspace, Class name = v, completed in 254ms, has a falsy return value, Arg 1: <Uri:/Users/xxx/Developer/xxx>, Return Value: undefined [Error: command 'python.analysis.restartLanguageServer' already exists
at _.registerCommand (/Users/xxx/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:674:270)
at Object.registerCommand (/Users/xxx/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:977:119)
at s.registerCommand (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:54:495185)
at new r (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:54:178371)
at Object.t.resolveInstance (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265970)
at /Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265172
at Array.map (<anonymous>)
at Object.t.resolveInstance (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265740)
at /Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265172
at Object.t.resolve (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265439)
at /Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:256520
at e._get (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:256286)
at e.getTagged (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:255088)
at e.getNamed (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:255180)
at a.get (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:1055572)
at C.createRefCountedServer (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:303140)
at async C.activate (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:301001)
at async Promise.all (index 4)
at async v.activateWorkspace (/Users/xxx/.vscode/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:296083)]
Do you have a sample repo I could use to reproduce the issue, because I did not experience this issue with the steps you outlined:
What is what is the value of the python.languageServer setting in your user settings and your workspace? Could you also copy the logs of the Python output channel?
Kim-Adeline Miguel (@kimadeline) , your GIF showed exactly what I meant. In my settings, "python.languageServer": "Microsoft". My workspace has no custom settings.
Start a new window. Add the 2 folders mentioned above.
Open file ENSFM/code/ENSFM.py, then open facebook-DLRM/data_utils.py
After the above steps finished, the logs from Python channel are:
User belongs to experiment group 'AlwaysDisplayTestExplorer - control'
User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
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 'AA_testing - 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'
Error 2020-09-28 16:21:51: Failed to initialize source map support in extension
User belongs to experiment group 'pythonaacf'
> conda --version
> pyenv root
> python3.7 ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
> conda info --json
> conda info --json
> conda env list
Error 2020-09-28 16:21:53: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file '/Users/xxxx/Developer/github.com/ENSFM/.vscode/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/Users/xxxx/Developer/github.com/ENSFM/.vscode/settings.json')
at _handleError (/Users/xxxx/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:706:74)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async y.readText (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:1:498595)
at async p.doesFileNeedToBeFixed (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:56:960982)
at async /Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:56:960109
at async Promise.all (index 1)
at async p.getFilesToBeFixed (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:56:960055)
at async p.updateTestSettings (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:56:959682)] {
code: 'FileNotFound',
name: 'EntryNotFound (FileSystemError)'
}
> conda env list
Starting Microsoft Python language server.
Python interpreter path: /usr/local/anaconda3/envs/kaggle/bin/python
> /usr/local/anaconda3/envs/easytf_dev/bin/python ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/local/anaconda3/envs/easytf_dev/bin/python ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> /usr/local/anaconda3/envs/easytf_dev/bin/python ~/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
Starting Microsoft Python language server.
Error 2020-09-28 16:22:25: Failed to activate a workspace, Class name = y, completed in 230ms, has a falsy return value, Arg 1: <Uri:/Users/xxxx/Developer/github.com/facebook-DLRM>, Return Value: undefined [Error: command 'python.analysis.restartLanguageServer' already exists
at _.registerCommand (/Users/xxxx/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:674:270)
at Object.registerCommand (/Users/xxxx/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:977:119)
at s.registerCommand (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:54:373547)
at new r (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:54:51397)
at Object.t.resolveInstance (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:266184)
at /Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:265386
at Array.map (<anonymous>)
at Object.t.resolveInstance (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:265954)
at /Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:265386
at Object.t.resolve (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:265653)
at /Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:256734
at e._get (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:256500)
at e.getTagged (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:255302)
at e.getNamed (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:255394)
at a.get (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:56:1063072)
at C.createRefCountedServer (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:303871)
at async C.activate (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:301732)
at async Promise.all (index 4)
at async y.activateWorkspace (/Users/xxxx/.vscode/extensions/ms-python.python-2020.9.111407/out/client/extension.js:47:296814)]
Here. The entire implementation of this command is in the core extension. These commands are unknown to any LS directly, as the core extension manages the entire lifetime of the LS. #12952
The command gets registered in the LS manager. There should only be one of those at as time depending on the LS setting choice. I'm not sure how it's possible without some violation of the injection system.
changed the title [-]Extension Bug: command 'python.analysis.restartLanguageServer' already exists[/-][+]Command 'python.analysis.restartLanguageServer' already exists when using MPLS[/+]on Sep 28, 2020
My patch that added this adds the command disposal, but it's likely that it's not actually getting disposed for some reason. Maybe it needs to be shoved down further so that it can only be available when the LS is running.
In the meantime maybe we could work around this in the commandRegistry by ensuring we call registerCommand once for each command? i.e. the commandRegistry would cache commands that it's already registered.
The problem would be if the old command is referencing a dead LS client, and therefore does nothing. I suppose that this is rare though where you need to change a setting (and are already in a bad state) and reload, so maybe it's not a huge problem.
Followed the repro steps above (set language server to 'Microsoft', cloned the two repos, opened a Python file from each). It seems like what's happening is the following:
ILanguageServerManager is not added as a singleton to the service container
When the user opens the second folder, a new instance of the ILanguageServerManager is created
This causes the constructor to be called twice
The command gets registered twice
I debugged this locally and can verify that the constructor was called twice, and that's likely the source of the duplicate command registrations. Can the ILanguageServerManager be made a singleton? If a new one really needs to be created per folder in a workspace, the command may need to be registered elsewhere.
It can't be a singleton due to multi-root (one MPLS per root), but that's been broken for a while. The individual LS is what needs to be restarted, so having more than one technically breaks that down because you have to ask "which LS to restart". It's likely my implementation was too simple and needed to go and restart every running LS or something, and register the command elsewhere.
needed to go and restart every running LS or something, and register the command elsewhere.
Yeah that makes sense, or maybe figure out which LS to restart based on the active root. In any case this error isn't fatal for our smoke tests so we don't urgently need a fix.
+1 Kim-Adeline Miguel (@kimadeline) solution about use Pylance works!! But, I think that "python.languageServer": "Microsoft" should work as well, right?
changed the title [-]Command 'python.analysis.restartLanguageServer' already exists when using MPLS[/-][+]Command 'python.analysis.restartLanguageServer' already exists[/+]on Apr 29, 2021
Activity
[-]Extension :warning:[/-][+]Extension Bug[/+]yousefabuz17 commentedon Aug 15, 2020
Python 2020.8.101144 has many bugs, downgrade it to the one below it and everything should be fine. I issued a bug where the terminal would not accept any keyboard inputs and took me so long to realize what happened and its because python has a very recent update and downgrading it worked.
[-]Extension Bug[/-][+]Extension Bug: command 'python.analysis.restartLanguageServer' already exists[/+]kimadeline commentedon Aug 18, 2020
Hi Haden Moore (@HadenMoore), thank you for reaching out!
Does this behaviour happen consistently, and would yousefabuz17 downgrading suggestion work as a workaround for now?
I couldn't reproduce your issue on macOS 10.15.6, VS Code 1.48.0 and the Python extension 2020.8.101144, what is the value of the
python.languageServersetting in your user settings?Thank you!
leonhx commentedon Sep 23, 2020
Hi Kim-Adeline Miguel (@kimadeline) , I can constantly reproduce this issue: firstly add multiple folders to a workspace, open a file in one folder, then switch to a file from another folder(it is the key point), then an error occurs:
Version: 1.49.1
Commit: 58bb7b2331731bf72587010e943852e13e6fd3cf
Date: 2020-09-16T23:21:17.533Z (6 days ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0
ms-python: v2020.8.109390
kimadeline commentedon Sep 24, 2020
Hi (Leon) X. Huang (@leonhx),
Do you have a sample repo I could use to reproduce the issue, because I did not experience this issue with the steps you outlined:
What is what is the value of the
python.languageServersetting in your user settings and your workspace? Could you also copy the logs of thePythonoutput channel?Thanks!
leonhx commentedon Sep 28, 2020
Kim-Adeline Miguel (@kimadeline) , your GIF showed exactly what I meant. In my settings,
"python.languageServer": "Microsoft". My workspace has no custom settings.Here's a more specific reproduce procedure:
After the above steps finished, the logs from
Pythonchannel are:Environment:
6 remaining items
jakebailey commentedon Sep 28, 2020
Here. The entire implementation of this command is in the core extension. These commands are unknown to any LS directly, as the core extension manages the entire lifetime of the LS. #12952
The command gets registered in the LS manager. There should only be one of those at as time depending on the LS setting choice. I'm not sure how it's possible without some violation of the injection system.
kimadeline commentedon Sep 28, 2020
Yeah, I don't know how that happens either. Maybe something to do with multi-root workspaces and being called for each workspace?
In any case, it doesn't happen when using Pylance.
[-]Extension Bug: command 'python.analysis.restartLanguageServer' already exists[/-][+]Command 'python.analysis.restartLanguageServer' already exists when using MPLS[/+]rchiodo commentedon Nov 13, 2020
We get this on our smoke tests now.
https://github.com/microsoft/vscode-jupyter/runs/1398220329?check_suite_focus=true
It seems like it would happen when switching language servers if you don't restart.
jakebailey commentedon Nov 13, 2020
My patch that added this adds the command disposal, but it's likely that it's not actually getting disposed for some reason. Maybe it needs to be shoved down further so that it can only be available when the LS is running.
joyceerhl commentedon Nov 18, 2020
In the meantime maybe we could work around this in the commandRegistry by ensuring we call
registerCommandonce for each command? i.e. the commandRegistry would cache commands that it's already registered.jakebailey commentedon Nov 18, 2020
The problem would be if the old command is referencing a dead LS client, and therefore does nothing. I suppose that this is rare though where you need to change a setting (and are already in a bad state) and reload, so maybe it's not a huge problem.
joyceerhl commentedon Nov 18, 2020
Followed the repro steps above (set language server to 'Microsoft', cloned the two repos, opened a Python file from each). It seems like what's happening is the following:
I debugged this locally and can verify that the constructor was called twice, and that's likely the source of the duplicate command registrations. Can the ILanguageServerManager be made a singleton? If a new one really needs to be created per folder in a workspace, the command may need to be registered elsewhere.
jakebailey commentedon Nov 18, 2020
It can't be a singleton due to multi-root (one MPLS per root), but that's been broken for a while. The individual LS is what needs to be restarted, so having more than one technically breaks that down because you have to ask "which LS to restart". It's likely my implementation was too simple and needed to go and restart every running LS or something, and register the command elsewhere.
joyceerhl commentedon Nov 18, 2020
Yeah that makes sense, or maybe figure out which LS to restart based on the active root. In any case this error isn't fatal for our smoke tests so we don't urgently need a fix.
mfdeveloper commentedon Feb 1, 2021
+1 Kim-Adeline Miguel (@kimadeline) solution about use Pylance works!! But, I think that
"python.languageServer": "Microsoft"should work as well, right?[-]Command 'python.analysis.restartLanguageServer' already exists when using MPLS[/-][+]Command 'python.analysis.restartLanguageServer' already exists[/+]