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

Starting ruff server fails #483

Closed
MaheshNat opened this issue May 30, 2024 · 10 comments
Closed

Starting ruff server fails #483

MaheshNat opened this issue May 30, 2024 · 10 comments

Comments

@MaheshNat
Copy link

MaheshNat commented May 30, 2024

I continuously get this output:

2024-05-30 22:38:49.610 [info] [Error - 10:38:49 PM] Server initialization failed.
2024-05-30 22:38:49.610 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-05-30 22:38:49.610 [info] [Info  - 10:38:49 PM] Connection to server got closed. Server will restart.
2024-05-30 22:38:49.610 [info] true
2024-05-30 22:38:49.610 [info] [Error - 10:38:49 PM] Ruff client: couldn't create connection to server.
2024-05-30 22:38:49.610 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-05-30 22:38:49.610 [info] [Error - 10:38:49 PM] Restarting server failed
2024-05-30 22:38:49.610 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-05-30 22:38:50.067 [info] Traceback (most recent call last):
  File "/root/.vscode-server/extensions/charliermarsh.ruff-2024.22.0-linux-x64/bundled/tool/server.py", line 67, in <module>

2024-05-30 22:38:50.067 [info]     main()
  File "/root/.vscode-server/extensions/charliermarsh.ruff-2024.22.0-linux-x64/bundled/tool/server.py", line 29, in main
    from ruff_lsp import server
  File "/root/.vscode-server/extensions/charliermarsh.ruff-2024.22.0-linux-x64/bundled/libs/ruff_lsp/server.py", line 77, in <module>
    from pygls import server, uris, workspace
  File "/root/.vscode-server/extensions/charliermarsh.ruff-2024.22.0-linux-x64/bundled/libs/pygls/server.py", line 36, in <module>
    from pygls import IS_PYODIDE
ImportError: cannot import name 'IS_PYODIDE' from 'pygls' (unknown location)

every time I start the ruff server. I am using uv 0.2.4 inside a debian 12 docker container with vscode 1.89.1 on linux. the ruff extension is installed inside the container using vscode's dev containers tool. I am using ruff v2024.22.0

@MaheshNat
Copy link
Author

MaheshNat commented May 31, 2024

i downgraded to extension version v2024.20.0 and the error went away.

@dhruvmanila
Copy link
Member

Do you have a Dockerfile or docker-compose file which I can use to try reproducing this locally?

the ruff extension is installed inside the container using vscode's dev containers tool.

Are you referring to https://github.com/devcontainers/cli by "tool"? Can you provide the command you used to create this?

Sorry, this might be some basic questions but I haven't worked with VS Code dev containers.

@MichaReiser MichaReiser added the needs-mre Needs more information for reproduction label Jun 17, 2024
@vasudev-gm
Copy link

Been using Ruff vscode for more than a year. This time I decided to beta test the rust LSP in my test projects on windows 10. Now it's constantly crashing. The odd thing is I never installed ruff in my virtual environment and continued to use bundled version with Vscode Ruff extension setting: "ruff.importStrategy": "useBundled"

Here is the traceback:

`2024-07-10 20:01:17.450 [info] Traceback (most recent call last):
File "c:\Users\Vasudev.vscode\extensions\charliermarsh.ruff-2024.30.0-win32-x64\bundled\tool\ruff_server.py", line 90, in
check_compatibility(ruff, RUFF_VERSION_REQUIREMENT)
File "c:\Users\Vasudev.vscode\extensions\charliermarsh.ruff-2024.30.0-win32-x64\bundled\tool\ruff_server.py", line 55, in check_compatibility
raise RuntimeError(message)
RuntimeError: Ruff >=0.3.5 required, but found 0.0.254 at C:\Users\Vasudev\AppData\Local\Programs\Python\Python311\Scripts\ruff.EXE

2024-07-10 20:01:17.481 [info] [Error - 8:01:17 PM] Server initialization failed.
2024-07-10 20:01:17.481 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2024-07-10 20:01:17.481 [info] [Error - 8:01:17 PM] The Ruff server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2024-07-10 20:01:17.481 [info] [Error - 8:01:17 PM] Ruff client: couldn't create connection to server.
2024-07-10 20:01:17.481 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2024-07-10 20:01:17.482 [info] [Error - 8:01:17 PM] Restarting server failed
2024-07-10 20:01:17.482 [info] Message: Pending response rejected since connection got disposed
Code: -32097 `

VSCode Config:
Version: 1.91.0 Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286 Date: 2024-07-01T18:52:22.949Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.19045

@MichaReiser
Copy link
Member

@vasudev-gm I'm sorry that you ran into this issue. I think this should be fixed on main (#509) but hasn't yet been released.

@dhruvmanila
Copy link
Member

Yeah, #509 should resolve this and additionally, the error message (RuntimeError: Ruff >=0.3.5 required, but found 0.0.254 at C:\Users\Vasudev\AppData\Local\Programs\Python\Python311\Scripts\ruff.EXE) has been improved in #512.

@vasudev-gm
Copy link

vasudev-gm commented Jul 11, 2024 via email

@T-256
Copy link

T-256 commented Jul 12, 2024

@vasudev-gm
For temporary workaround, you could remove ruff from C:\Users\Vasudev\AppData\Local\Programs\Python\Python311\Scripts\ruff.EXE which then it will properly use bundled version.

@dhruvmanila
Copy link
Member

@vasudev-gm Can you try upgrading the extension and try again?

@dhruvmanila dhruvmanila removed the needs-mre Needs more information for reproduction label Jul 23, 2024
@vasudev-gm
Copy link

vasudev-gm commented Jul 23, 2024 via email

@dhruvmanila
Copy link
Member

Thank you for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants