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

Pylance fails to start on VS Code launch #5962

Closed
olegstepanov opened this issue Jun 3, 2024 · 13 comments
Closed

Pylance fails to start on VS Code launch #5962

olegstepanov opened this issue Jun 3, 2024 · 13 comments
Assignees
Labels
user responded Was "waiting for user response" and they responded

Comments

@olegstepanov
Copy link

olegstepanov commented Jun 3, 2024

Environment data

  • Language Server version: 2024.5.1
  • OS and version: linux x64
  • Python version (and distribution if applicable, e.g. Anaconda):
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: off

Logs

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object._0x13e5f3.f.<computed> [as require] (/home/ogstepanov/.vscode-server/extensions/ms-python.vscode-pylance-2024.5.1/dist/server.bundle.js:1:980819)
    at /home/ogstepanov/.vscode-server/extensions/ms-python.vscode-pylance-2024.5.1/dist/server.bundle.js:1:979283
    at Array.reduce (<anonymous>)

2024-06-03 21:47:51.479 [info] [Error - 9:47:51 PM] Server initialization failed.
2024-06-03 21:47:51.479 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-03 21:47:51.479 [info] [Error - 9:47:51 PM] Pylance client: couldn't create connection to server.
2024-06-03 21:47:51.479 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-03 21:47:51.480 [info] [Error - 9:47:51 PM] Pylance has crashed 5 times in the last 3 minutes. Pylance will not be restarted. See the output for more information.
2024-06-03 21:47:51.480 [info] [Error - 9:47:51 PM] Restarting server failed
2024-06-03 21:47:51.480 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-03 21:47:51.485 [info] [Error - 9:47:51 PM] Server process exited with code 1.
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jun 3, 2024
@StellaHuang95
Copy link
Contributor

Could be your Pylance package is corrupted. Could you try deleting the local package and reinstalling it? You can find where your extension is installed here: https://code.visualstudio.com/docs/editor/extension-marketplace#_where-are-extensions-installed

@StellaHuang95 StellaHuang95 added waiting for user response Requires more information from user and removed needs repro Issue has not been reproduced yet labels Jun 4, 2024
@olegstepanov
Copy link
Author

I reinstalled Pylance, but the error is still there.

@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels Jun 9, 2024
@StellaHuang95
Copy link
Contributor

Did you delete the local cached version first?

@olegstepanov
Copy link
Author

Yes, I did

cd ~/.vscode-server/extensions/
rm -rf *pylance*

on the remote machine.

@rchiodo
Copy link
Contributor

rchiodo commented Jun 10, 2024

You might check if you have NODE_ related environment variables specified on the remote machine. They could be interferring with execution like this issue:
#5911

@rchiodo
Copy link
Contributor

rchiodo commented Jun 10, 2024

One of the things to try is to just run our server.bundle.js with node like I outlined here:
#5911 (comment)

@olegstepanov
Copy link
Author

I don't have any NODE_* environment variables on the machine. I ran node server.bundle.js and the output is:

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object._0x48e40e.f.<computed> [as require] (/home/ogstepanov/.vscode-server/extensions/ms-python.vscode-pylance-2024.6.1/dist/server.bundle.js:1:1125450)
    at /home/ogstepanov/.vscode-server/extensions/ms-python.vscode-pylance-2024.6.1/dist/server.bundle.js:1:1123902
    at Array.reduce (<anonymous>)

@rchiodo
Copy link
Contributor

rchiodo commented Jun 10, 2024

What's your version of node on the remote server?

@olegstepanov
Copy link
Author

v12.22.9

@rchiodo
Copy link
Contributor

rchiodo commented Jun 10, 2024

That may explain it. We need at least version 14 I believe.

@rchiodo
Copy link
Contributor

rchiodo commented Jun 10, 2024

vscode-server should be using its own version though. Unless you have this set:

python.analysis.nodeExecutable.

@olegstepanov
Copy link
Author

It was set indeed, and I don't remember why( Sorry for bothering and thanks a lot for your help!

@olegstepanov
Copy link
Author

I think this is what happened #5991. It suggests to switch to local node executable in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user responded Was "waiting for user response" and they responded
Projects
None yet
Development

No branches or pull requests

3 participants