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

The isort server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. #316

Closed
q447552640 opened this issue Aug 18, 2023 · 10 comments · Fixed by #417
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug needs PR

Comments

@q447552640
Copy link

2023-08-19 01:13:09.305 [info] Name: isort
2023-08-19 01:13:09.305 [info] Module: isort
2023-08-19 01:13:09.305 [info] Python extension loading
2023-08-19 01:13:09.305 [info] Waiting for interpreter from python extension.
2023-08-19 01:13:09.305 [info] No interpreter found from setting isort.interpreter
2023-08-19 01:13:09.305 [info] Getting interpreter from ms-python.python extension for workspace d:\work\njbdbd\dreamface\DreamSpaceLiveStream
2023-08-19 01:13:09.305 [info] Python extension loaded
2023-08-19 01:13:09.305 [info] Interpreter from ms-python.python extension for d:\work\njbdbd\dreamface\DreamSpaceLiveStream: d:\work\njbdbd\dreamface\python39\python.exe
2023-08-19 01:13:09.305 [info] No interpreter found from setting isort.interpreter
2023-08-19 01:13:09.328 [info] Getting interpreter from ms-python.python extension for workspace d:\work\njbdbd\dreamface\DreamSpaceLiveStream
2023-08-19 01:13:09.328 [info] Interpreter from ms-python.python extension for d:\work\njbdbd\dreamface\DreamSpaceLiveStream: d:\work\njbdbd\dreamface\python39\python.exe
2023-08-19 01:13:09.328 [info] Server run command: d:\work\njbdbd\dreamface\python39\python.exe c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\lsp_server.py
2023-08-19 01:13:09.328 [info] Server: Start requested.
2023-08-19 01:13:10.526 [info] Traceback (most recent call last):
File "c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\lsp_server.py", line 39, in
import lsp_jsonrpc as jsonrpc
ModuleNotFoundError: No module named 'lsp_jsonrpc'

2023-08-19 01:13:10.556 [info] [Error - 01:13:10] Server initialization failed.
2023-08-19 01:13:10.556 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:10.557 [info] [Info - 01:13:10] Connection to server got closed. Server will restart.
2023-08-19 01:13:10.557 [info] true
2023-08-19 01:13:10.557 [info] [Error - 01:13:10] isort client: couldn't create connection to server.
2023-08-19 01:13:10.557 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:11.168 [info] Traceback (most recent call last):
File "c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\lsp_server.py", line 39, in

2023-08-19 01:13:11.169 [info] import lsp_jsonrpc as jsonrpc
ModuleNotFoundError: No module named 'lsp_jsonrpc'

2023-08-19 01:13:13.769 [info] [Error - 01:13:13] Server initialization failed.
2023-08-19 01:13:13.770 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:13.770 [info] [Info - 01:13:13] Connection to server got closed. Server will restart.
2023-08-19 01:13:13.770 [info] true
2023-08-19 01:13:13.770 [info] [Error - 01:13:13] isort client: couldn't create connection to server.
2023-08-19 01:13:13.770 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:13.770 [error] Server: Start failed: Error: Pending response rejected since connection got disposed
2023-08-19 01:13:14.365 [info] Traceback (most recent call last):
File "c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\lsp_server.py", line 39, in
import lsp_jsonrpc as jsonrpc
ModuleNotFoundError: No module named 'lsp_jsonrpc'

2023-08-19 01:13:14.386 [info] [Error - 01:13:14] Server initialization failed.
2023-08-19 01:13:14.386 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:14.386 [info] [Info - 01:13:14] Connection to server got closed. Server will restart.
2023-08-19 01:13:14.386 [info] true
2023-08-19 01:13:14.386 [info] [Error - 01:13:14] isort client: couldn't create connection to server.
2023-08-19 01:13:14.386 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:14.387 [info] [Error - 01:13:14] Restarting server failed
2023-08-19 01:13:14.387 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:15.303 [info] Traceback (most recent call last):
File "c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\lsp_server.py", line 39, in
import lsp_jsonrpc as jsonrpc
ModuleNotFoundError: No module named 'lsp_jsonrpc'

2023-08-19 01:13:15.331 [info] [Error - 01:13:15] Server initialization failed.
2023-08-19 01:13:15.331 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:15.332 [info] [Info - 01:13:15] Connection to server got closed. Server will restart.
2023-08-19 01:13:15.332 [info] true
2023-08-19 01:13:15.332 [info] [Error - 01:13:15] isort client: couldn't create connection to server.
2023-08-19 01:13:15.332 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:15.332 [info] [Error - 01:13:15] Restarting server failed
2023-08-19 01:13:15.332 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:15.799 [info] Traceback (most recent call last):
File "c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\lsp_server.py", line 39, in
import lsp_jsonrpc as jsonrpc
ModuleNotFoundError: No module named 'lsp_jsonrpc'

2023-08-19 01:13:15.803 [info] [Error - 01:13:15] Server initialization failed.
2023-08-19 01:13:15.803 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:15.803 [info] [Error - 01:13:15] The isort server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2023-08-19 01:13:15.803 [info] [Error - 01:13:15] isort client: couldn't create connection to server.
2023-08-19 01:13:15.803 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-08-19 01:13:15.803 [info] [Error - 01:13:15] Restarting server failed
2023-08-19 01:13:15.803 [info] Message: Pending response rejected since connection got disposed
Code: -32097

@github-actions github-actions bot added the triage-needed Issue is not triaged. label Aug 18, 2023
@karthiknadig
Copy link
Member

Can you run dir on this directory to ensure that it has all the needed files?
c:\Users\admin.vscode\extensions\ms-python.isort-2023.10.1\bundled\tool\

Are you using any custom encoding in your OS?

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster and removed triage-needed Issue is not triaged. labels Aug 23, 2023
@loskutov
Copy link

loskutov commented Sep 12, 2023

I am facing a similar issue. In my case, it's also about:

bundled/tool/lsp_server.py", line 39, in <module>
    import lsp_jsonrpc as jsonrpc
ModuleNotFoundError: No module named 'lsp_jsonrpc'

Indeed, bundled/tool is not in sys.path (update_sys_path() is only called with pathlib.Path(__file__).parent.parent / "libs")

See also https://github.com/microsoft/vscode-black-formatter/pull/286/files

@karthiknadig
Copy link
Member

This seems to be the case for embedded/portable python. I am open for a PR adding the changes that were done for black to address this.

@karthiknadig karthiknadig added needs PR and removed info-needed Issue requires more information from poster labels Sep 12, 2023
@Column01
Copy link

Column01 commented Jan 10, 2024

Also having this issue, the bundled install doesn't find the modules needed. Do not want to install them to my venv for the project either. I've gotten around this so far by installing it to another environment and then I pointed the extension to that one, but that's not ideal

@MiltiadisKoutsokeras
Copy link

MiltiadisKoutsokeras commented Jan 30, 2024

I get this error:

2024-01-30 13:01:47.361 [info] Traceback (most recent call last):
  File "<HOME FOLDER HERE>/.vscode-oss/extensions/ms-python.isort-2023.10.1-universal/bundled/tool/lsp_server.py", line 41, in <module>
    import lsprotocol.types as lsp
ModuleNotFoundError: No module named 'lsprotocol'

I use Debian Linux 11, Python 3.9.2, isort v2023.10.1, VSCodium 1.85.2 (c8a36a69377856369f139f39ee56dd3838130fbf).

@MiltiadisKoutsokeras
Copy link

Is there any updates on this?

@karthiknadig
Copy link
Member

@MiltiadisKoutsokeras If you are not using portable python then make sure the following directory exists in the extension.
<HOME>/.vscode-oss/extensions/ms-python.isort-2023.10.1-universal/bundled/lib. If it is not present then the OSS version of the extension build is broken.

@MiltiadisKoutsokeras
Copy link

I am coming back to this, indeed the directory <HOME>/.vscode-oss/extensions/ms-python.isort-2023.10.1-universal/bundled/lib is not present. The contents of a freshly installed plugin v2023.10.1 on VSCodium 1.88.0:

$ tree ~/.vscode-oss/extensions/ms-python.isort-2023.10.1-universal
/home/<user>/.vscode-oss/extensions/ms-python.isort-2023.10.1-universal
├── CHANGELOG.md
├── LICENSE.txt
├── NOTICE.txt
├── README.md
├── SECURITY.md
├── SUPPORT.md
├── bundled
│   └── tool
│       ├── __init__.py
│       ├── __pycache__
│       │   ├── lsp_jsonrpc.cpython-39.pyc
│       │   └── lsp_utils.cpython-39.pyc
│       ├── lsp_jsonrpc.py
│       ├── lsp_runner.py
│       ├── lsp_server.py
│       ├── lsp_utils.py
│       └── script_runner.py
├── dist
│   └── extension.js
├── icon.png
├── images
│   └── vscode-isort.gif
├── package.json
├── package.nls.json
├── runtime.txt
└── test-results.xml

@karthiknadig
Copy link
Member

@MiltiadisKoutsokeras This issue is with how the package was created by whoever uploaded to the VSCodium's extension store. If you download the VSIX from the VS Code store you will see that it exists. Please raise an issue on the there. There is nothing we can do here.

@nriley
Copy link

nriley commented May 9, 2024

I am having this problem with the official MS release of VSCode on Windows and the official VSCode store, not using VSCodium.

The problem as others have identified seems to be that the directory bundled\tool is not in the Python path.

I am using a portable Python as I am not an administrator on this computer and cannot install Python for the system. Here's what PYTHONPATH looks like prior to me doing this.

['c:\\Users\\nriley\\.vscode\\extensions\\ms-python.isort-2023.13.10681007\\bundled\\libs',
'',
'C:\\Users\\nriley\\Apps\\Python\\python311.zip',
'C:\\Users\\nriley\\Apps\\Python',
'C:\\Users\\nriley\\Apps\\Python\\Lib\\site-packages',
'C:\\Users\\nriley\\Apps\\Python\\Lib\\site-packages\\win32',
'C:\\Users\\nriley\\Apps\\Python\\Lib\\site-packages\\win32\\lib',
'C:\\Users\\nriley\\AppData\\Roaming\\Python\\venv\\3.11',
'C:\\Users\\nriley\\AppData\\Roaming\\Python\\venv\\3.11\\Lib\\site-packages']

Copying the following lines from the linked vscode-black commit and adding them to lsp_server.py fixed the issue:

BUNDLE_DIR = pathlib.Path(__file__).parent.parent
# Always use bundled server files.
update_sys_path(os.fspath(BUNDLE_DIR / "tool"), "useBundled")

Unfortunately I do not have time to submit a PR right now but did not want to get this lost, as I was somewhat confused reading this issue that the original reported problem is still a problem with a known solution and just awaiting a PR to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug needs PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants