Error: command 'pyright.createtypestub' already exists
[Info - 7:56:43 AM] (46164) Pylance language server 2022.4.4-pre.1 (pyright 88f2a424) starting [Info - 7:56:43 AM] (46164) Server root directory: c:\Users\shaunm.vscode-insiders\extensions\ms-python.vscode-pylance-2022.4.4-pre.1\dist [Error - 7:56:43 AM] Server initialization failed. Error: command 'pyright.createtypestub' already exists at o.registerCommand (c:\Users\shaunm\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:83:29716) at Object.registerCommand (c:\Users\shaunm\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:30972) at t.ExecuteCommandFeature.register (c:\Users\shaunm.vscode-insiders\extensions\ms-python.python-2022.5.11231003\out\client\extension.js:2:2220058) at t.ExecuteCommandFeature.initialize (c:\Users\shaunm.vscode-insiders\extensions\ms-python.python-2022.5.11231003\out\client\extension.js:2:2219637) at S.initializeFeatures (c:\Users\shaunm.vscode-insiders\extensions\ms-python.python-2022.5.11231003\out\client\extension.js:2:2172202) at S.doInitialize (c:\Users\shaunm.vscode-insiders\extensions\ms-python.python-2022.5.11231003\out\client\extension.js:2:2160126) at async S.start (c:\Users\shaunm.vscode-insiders\extensions\ms-python.python-2022.5.11231003\out\client\extension.js:2:2157141) at async f.start (c:\Users\shaunm.vscode-insiders\extensions\ms-python.python-2022.5.11231003\out\client\extension.js:2:34030) [Error - 7:56:43 AM] Python Tools client: couldn't create connection to server.
Thanks for the report. This can happen if Pyright and Pylance extensions are both installed. Is this the case for you? If so, could you please uninstall one of them?
Discussed this with Eric today. When both Pyright and Pylance are installed, Pyright will detect that Pylance is present and disable itself. Best guess is that this exception happens in cases where Pyright is already installed and the user installs Pylance after Pyright has activated.
In any case, nothing has changed with this logic on our side recently. But there has clearly been a change in behavior since we've seen this exception in our stack traces over the past couple weeks and now a user has reported it.
Our theory is that the LSP 3.17 upgrade included a change to throw an exception when an extension attempts to register an already registered command, whereas it used to be silent. Plan is to just catch the exception.
I have the Pylance extension installed but not the Pyright extension. That is to say, the pyright extension doesn't appear in the list of installed extensions and it doesn't appear in the list of running extensions.
I have the Pylance extension installed but not the Pyright extension.
Wow, ok. Can you send us a list of the extensions you have installed? You can dump the list of extensions on the command line using code --list-extensions
E:>code-insiders --list-extensions ms-dotnettools.vscode-dotnet-runtime ms-python.python ms-python.vscode-pylance ms-toolsai.jupyter ms-toolsai.jupyter-keymap ms-toolsai.jupyter-renderers ms-vscode-remote.remote-wsl ms-vscode.cpptools ms-vscode.powershell-preview VisualStudioExptTeam.intellicode-api-usage-examples VisualStudioExptTeam.vscodeintellicode-completions VisualStudioExptTeam.vscodeintellicode-insiders
Also ran into this problem today after setting up a new VS Code instance and syncing my settings. Here's my list of extensions:
sanqui@myrtus ~> code --list-extensions
eamodio.gitlens
gerane.Theme-Cobalt
HookyQR.beautify
jock.svg
ms-azuretools.vscode-docker
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode.cpptools
RandomFractalsInc.vscode-data-preview
RoscoP.fastbuild
samuelcolvin.jinjahtml
svelte.svelte-vscode
wesbos.theme-cobalt2
Version: Pylance language server 2022.4.3 (pyright 88f2a424)
I also head same probelm after changing conda virtual environment. Here's my extension lists.
(base) C:\Users\user>code --list-extensions cschlosser.doxdocgen Equinusocio.vsc-community-material-theme Equinusocio.vsc-material-theme equinusocio.vsc-material-theme-icons jeff-hykin.better-cpp-syntax ms-python.python ms-python.vscode-pylance ms-toolsai.jupyter ms-toolsai.jupyter-keymap ms-toolsai.jupyter-renderers ms-vscode-remote.remote-containers ms-vscode-remote.remote-ssh ms-vscode-remote.remote-ssh-edit ms-vscode-remote.remote-wsl ms-vscode.cmake-tools ms-vscode.cpptools ms-vscode.cpptools-extension-pack ms-vscode.cpptools-themes oderwat.indent-rainbow twxs.cmake
Same thing here - just installed VS Code and getting this error:
[Error - 3:47:25 PM] Pylance client: couldn't create connection to server.
Error: command 'pyright.createtypestub' already exists
Version: Pylance language server 2022.4.3 (pyright 88f2a424)
here's my extensions list:
user@xxx ~ % code --list-extensions
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
Same issue:
code --list-extensions
eamodio.gitlens
michelemelluso.gitignore
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
Reverting to Python extension version 2022.4.1 from 2022.6.0 resolved this issue for me, though your mileage may vary. I did not touch the Pylance extension version.
With version 2022.6.0, the issue wouldn't appear as long as I had a project folder open and contained my work in that regard.
With version 2022.4.1, the issue was gone, regardless of my current working status.
Edit: corrected "very" to "vary" - long workdays :)
Reverting to Python extension version 2022.4.1 from 2022.6.0 resolved this issue for me, though your mileage may very. I did not touch the Pylance extension version.
With version 2022.6.0, the issue wouldn't appear as long as I had a project folder open and contained my work in that regard.
With version 2022.4.1, the issue was gone, regardless of my current working status.
how to download 2022.4.1 version.
Reverting to Python extension version 2022.4.1 from 2022.6.0 resolved this issue for me, though your mileage may very. I did not touch the Pylance extension version. With version 2022.6.0, the issue wouldn't appear as long as I had a project folder open and contained my work in that regard. With version 2022.4.1, the issue was gone, regardless of my current working status.
how to download 2022.4.1 version.
Click on the extension within VS Code, click the arrow next to Uninstall, then "Install Another Version..."
I was also facing the same issue. Reverting back to Python extension version 2022.4.1 from 2022.6.0 resolved this issue for me. Thank you .
Thanks for the update. Based on these clues, this looks like it's probably a regression in the core Python extension. I wonder if the Python extension is unloading and then reloading Pylance but doing so in a way that the command 'pyright.createtypestub' isn't unregistered upon unload.
Same here, reverted to 2022.4.1 cured it also. Thank you @thomas-oconnell
> code --list-extensions
aaron-bond.better-comments
Cameron.vscode-pytest
DavidAnson.vscode-markdownlint
dawhite.mustache
dbaeumer.vscode-eslint
donjayamanne.python-environment-manager
DotJoshJohnson.xml
eamodio.gitlens
Equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
formulahendry.code-runner
ms-python.python
ms-python.vscode-pylance
nico-castell.linux-desktop-file
njpwerner.autodocstring
rangav.vscode-thunder-client
redhat.vscode-yaml
slightc.pip-manager
tomblind.local-lua-debugger-vscode
tomoki1207.pdf
trond-snekvik.simple-rst
Samesies:
code --list-extensions
akamud.vscode-theme-onedark
almenon.arepl
arcsector.vscode-splunk-search-linter
arcsector.vscode-splunk-search-syntax
cantonios.project-templates
DotJoshJohnson.xml
emilast.LogFileHighlighter
formulahendry.auto-rename-tag
KevinRose.vsc-python-indent
mgesbert.python-path
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-vscode-remote.remote-wsl
ms-vscode.powershell
PKief.material-icon-theme
PrateekMahendrakar.prettyxml
richie5um2.vscode-sort-json
ryuta46.multi-command
seanwu.vscode-qt-for-python
Splunk.splunk
stkb.rewrap
vscodevim.vim
zhuangtongfa.material-theme
Zignd.html-css-class-completion
I can also report that switching back to VS Code Python Extension v2022.04.01 resolved the issue for the time-being. (Right-click the extension on the VSCode side bar -> 'Install Another Version...' )
I have experienced the same today, and downgrading the core Python extension to v2022.4.1 fixed it for me.
Same issue, reverting Python core version solved it for me too.
I just updated to the 2022.7.11291008 Pre-Release version and the problem is also gone.
I'm also v2022.6.0 and the problem occurred after moving the source folder of the existing project. The problem went away when I restarted VSCode after a few minutes. However, the warning below is still occurring.
[Warn] (14348) stubPath 'my project folder path'\typings is not a valid directory.
The 'typings' folder was not created by me and does not exist in the my source folder. So, I don't know what that is.
Same issue. I have 3 versions of Python installed, 3.9.6, 3.10 and 3.8.5 but only switching to 3.8.5 causes this issue.
Same issue. My full log is below.
[Info - 11:30:50 AM] (78228) Pylance language server 2022.4.3 (pyright 88f2a424) starting [Info - 11:30:50 AM] (78228) Server root directory: /HOME_PATH/.vscode/extensions/ms-python.vscode-pylance-2022.4.3/dist [Warn - 11:30:50 AM] (78228) stubPath /MY_PROJECT_PATH/typings is not a valid directory. [Info - 11:31:08 AM] (78246) Pylance language server 2022.4.3 (pyright 88f2a424) starting [Info - 11:31:08 AM] (78246) Server root directory: /HOME_PATH/.vscode/extensions/ms-python.vscode-pylance-2022.4.3/dist [Error - 11:31:08 AM] Server initialization failed. Error: command 'pyright.createtypestub' already exists at o.registerCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:29716) at Object.registerCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:97:30972) at t.ExecuteCommandFeature.register (/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2221856) at t.ExecuteCommandFeature.initialize (/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2221435) at S.initializeFeatures (/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2174000) at S.doInitialize (/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2161924) at async S.start (/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2158939) at async S.$start (/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2165739) at async t.Delayer.
(/HOME_PATH/.vscode/extensions/ms-python.python-2022.6.1/out/client/extension.js:2:2164010) [Error - 11:31:08 AM] Pylance client: couldn't create connection to server.
Extensions:
code --list-extensions 2gua.rainbow-brackets aaron-bond.better-comments alefragnani.project-manager DotJoshJohnson.xml eamodio.gitlens Equinusocio.vsc-community-material-theme Equinusocio.vsc-material-theme equinusocio.vsc-material-theme-icons GrapeCity.gc-excelviewer KevinRose.vsc-python-indent Lencerf.beancount mhutchie.git-graph MS-CEINTL.vscode-language-pack-zh-hans ms-python.python ms-python.vscode-pylance ms-toolsai.jupyter ms-toolsai.jupyter-keymap ms-toolsai.jupyter-renderers ms-vscode-remote.remote-wsl njpwerner.autodocstring Shan.code-settings-sync Tyriar.sort-lines vscode-icons-team.vscode-icons
And I found a very strange problem, that is, with the same environment, only some projects had this situation, which is the other projects had not.
I switch to Python extension pre-release v2022.7.11311004, all of ok.
I have the same issue (and also some of my students). The list of extensions I have is:
C:\Users\xxxxxx>code --list-extensions
alexcvzz.vscode-sqlite
cschlosser.doxdocgen
enriquein.htmlentity-replacer
jeff-hykin.better-cpp-syntax
mborik.z80-macroasm
ms-azuretools.vscode-docker
ms-dotnettools.csharp
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-wsl
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
sharksym.asm-msx
tht13.html-preview-vscode
twxs.cmake
I haven't tried to revert to an older version of Python extension.
I hope it is useful
.
I have this problem after I set my defaultProfile with my self-configure commandline.

And I solve this problem by setting the terminal with the default one. (PowerShell)

vscode 1.67.1
[Info - 16:06:07] (8668) Pylance language server 2022.5.1 (pyright e0e07d31) starting
[Info - 16:06:07] (8668) Server root directory: c:\Users\MM\.vscode\extensions\ms-python.vscode-pylance-2022.5.1\dist
[Error - 16:06:07] Server initialization failed.
Error: command 'pyright.createtypestub' already exists
at o.registerCommand (c:\Users\MM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:83:29716)
at Object.registerCommand (c:\Users\MM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:30972)
at t.ExecuteCommandFeature.register (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2225181)
at t.ExecuteCommandFeature.initialize (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2224760)
at S.initializeFeatures (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2176688)
at S.doInitialize (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2164589)
at async S.start (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2161604)
at async h.start (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:33669)
[Error - 16:06:07] Pylance client: couldn't create connection to server.
Error: command 'pyright.createtypestub' already exists
at o.registerCommand (c:\Users\MM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:83:29716)
at Object.registerCommand (c:\Users\MM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:30972)
at t.ExecuteCommandFeature.register (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2225181)
at t.ExecuteCommandFeature.initialize (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2224760)
at S.initializeFeatures (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2176688)
at S.doInitialize (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2164589)
at async S.start (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2161604)
at async h.start (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:33669)
[Error - 16:06:07] Sending notification textDocument/didOpen failed.
Error: command 'pyright.createtypestub' already exists
at o.registerCommand (c:\Users\MM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:83:29716)
at Object.registerCommand (c:\Users\MM\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:97:30972)
at t.ExecuteCommandFeature.register (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2225181)
at t.ExecuteCommandFeature.initialize (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2224760)
at S.initializeFeatures (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2176688)
at S.doInitialize (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2164589)
at async S.start (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:2161604)
at async h.start (c:\Users\MM\.vscode\extensions\ms-python.python-2022.6.2\out\client\extension.js:2:33669)
[Error - 16:06:07] Sending notification textDocument/didOpen failed.
Error: command 'pyright.createtypestub' already exists
Same problem here after a fresh installation of vscode and a sync with my other vscode configurations.
same here. removed all extensions. reinst VS code. Still the same problem. In addition cannot run python files in the terminal only notebook exec works! wtf!
I also received same error when using OSX ssh to debug remotely, but noticed a reload was required of python extension, so did that, and the error went away.
python v2022.6.2 pylance v2022.5.1
For me, I think that this error started to occur after I installed pyright by mistake without knowing that pylance has it already in it and after I've uninstalled the pyright extension I started to notice this error. So I guess that someone could test this case: Make a fresh install of VSCode - don't sync nothing - install pylance - install pyright - uninstall pyright see if the error shows up.