-
Notifications
You must be signed in to change notification settings - Fork 765
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
Error: command 'pyright.createtypestub' already exists #2765
Comments
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. |
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 |
E:>code-insiders --list-extensions |
Also ran into this problem today after setting up a new VS Code instance and syncing my settings. Here's my list of extensions:
Version: |
I also head same probelm after changing conda virtual environment. Here's my extension lists. (base) C:\Users\user>code --list-extensions |
Same thing here - just installed VS Code and getting this error:
Version: here's my extensions list:
|
Same issue:
|
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 :) |
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
|
Samesies:
I can also report that switching back to VS Code Python Extension v2022.04.01 resolved the issue for the time-being. |
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. |
Same issue. My full log is below.
Extensions:
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'll have to double check with the absolute latest version of PyLance when I get time to look into this. I had this happen on version Edit: So, I'm not sure how PyRight is installed given that it shows as uninstalled in vs-code. The VS-Code version was |
@alexisart the fix is being tested using A/B test. you can try setting this hidden option |
I'm in similar scenario as @alexisart and after setting Edit: It is working with this setting on version |
Mine is not working.
|
@CarlGao4 after setting |
I realized that only some of the times when I start VSCode will encounter this, both using version 2023.6.0 and 2023.6.1 |
@CarlGao4 when you said |
Close and open it. I haven't encounter this issue since I upgraded to the pre-release and set |
hi there - in the past two weeks ive begun to get this issue constantly, I've been over in #4318 and it appears my issue was mis-diagnosed. It looks like this is an ongoing issue. Will try turning on |
|
yup so far so good will keep you posted |
The issue still occurs for me, but not always. Sometimes it happens on initial startup (after booting my laptop), or when closing VS Code and reopening the window. I am using the prerelease version of both the Python and Pylance extension, and the option "Python › Analysis: Pylance Lsp Client Enabled" is ticked on. |
ive seen no failures at all since applying the new parameter. |
@StijnvanderLippe are you using the latest version of python/pylance extension? |
@heejaechang I am using Pylance pre-release v2023.5.21 and Python pre-release v2023.9.11361009. By the way: I opened VS Code to check the version numbers. First start up: no issue. Just to check, I close VS Code (simply by clicking the x in the top right corner of the window) and re-open and I get the error messages. Subsequently closing and reopening VS Code brings up the error messages every time. |
@StijnvanderLippe Can you provide us some logs as described in the troubleshooting guide? I want to check that new client is actually enabled for us. |
I am using a virtual environment with Python 3.10.11. Note that this is not the full log, because the output seemed to include the whole source code for vendor.bundle.js to indicate where an error occurred. But it didn't have any formatting, so it was just thousands of lines of code. |
thank you! let me take a look! |
one more question, the folder/workspace you are using? is it trusted workspace or untrusted workspace? |
It is a trusted workspace. Also, when I went to open VS Code to check this, I got no error messages. I did not reboot my machine in the mean time. When I reopened shortly after, I get the error messages again. |
can I ask you one more question, if you give it a little bit of time say 15 seconds once you closed the |
Bad news, when I started up VS Code for the first time after booting my machine, the error messages popped up as well. So that is confusing. I tried various different delays: 10 seconds, 30 seconds, a minute, 3 minutes, and 5 minutes but every time the error messages pop up when opening VS Code again. Some of the times when I reopened VS Code I got slightly different error messages, see attached log messages. I waited 10 minutes and then no error message popped up when opening VS Code again. Closing and restarting quickly after this initially gave no error messages, but closing and restarting the second time did bring up the messages. I waited 10 minutes again, and no error messages popped up when opening VS Code. Closing and restarting quickly did bring up the messages. |
This also happens to me. For me it started after I accidentally installed the pyright extension because I didn't know that the functionality is already included in pylance. After I uninstalled the pyright extension the error messages appear now. |
Same, happening to me on Visual Studio Code - Insider, and pylance 2023.6.10 |
we didn't get any issue over this for long time now. closing. |
[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.
The text was updated successfully, but these errors were encountered: