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

Crashing on multi-root VSCode workspace #10

Open
Tracked by #58
Calychas opened this issue May 15, 2024 · 2 comments
Open
Tracked by #58

Crashing on multi-root VSCode workspace #10

Calychas opened this issue May 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Calychas
Copy link

Calychas commented May 15, 2024

Hi! First of all, thank you for creating this extension!

I have a problem with enabling it on multi-root VSCode workspace. I have one project with Kedro (installed in venv) and multiple of other projects (each with its own venv) without it.

The extension works correctly if I open one project directly.

Here are the logs from the beginning. I redacted it, but the important part is that its choosing the other project without Kedro - the 29th project in the workspace file (it's not first even alphabetically). The first entry is the one with Kedro:

2024-05-15 11:01:30.212 [info] Name: Kedro
2024-05-15 11:01:30.212 [info] Module: kedro
2024-05-15 11:01:30.212 [info] Python extension loading
2024-05-15 11:01:30.212 [info] Python Interpreter: 
2024-05-15 11:01:30.212 [info] Waiting for interpreter from python extension.
2024-05-15 11:01:30.212 [info] Python extension loaded
2024-05-15 11:01:30.230 [info] Server run command: /Users/kacper.lesniara/Projects/<the_other_project_without_kedro>/venv/bin/python /Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/bundled/tool/lsp_server.py
2024-05-15 11:01:30.231 [info] Server: Start requested.
2024-05-15 11:01:31.479 [info] Traceback (most recent call last):
  File "/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/bundled/tool/lsp_server.py", line 17, in <module>

2024-05-15 11:01:31.479 [info]     from kedro.config import OmegaConfigLoader
ModuleNotFoundError: No module named 'kedro'

Here are the error logs from the end:

2024-05-15 12:40:20.562 [info] [Error - 12:40:20] Client Kedro: connection to server is erroring. Shutting down server.
2024-05-15 12:40:20.562 [info] [Error - 12:40:20] Stopping server failed
2024-05-15 12:40:20.562 [info] Error: Client is not running and can't be stopped. It's current state is: starting
    at w.shutdown (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/common/client.js:914:29)
    at w._serverProcess (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/common/client.js:889:30)
    at w.stop (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/node/main.js:152:38)
    at w.handleConnectionError (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/common/client.js:1147:67)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-05-15 12:40:20.562 [info] [Error - 12:40:20] Server initialization failed.
2024-05-15 12:40:20.562 [info]   Message: write EPIPE
  Code: -32099 
2024-05-15 12:40:20.562 [info] [Error - 12:40:20] Kedro client: couldn't create connection to server.
2024-05-15 12:40:20.562 [info]   Message: write EPIPE
  Code: -32099 
2024-05-15 12:40:20.562 [info] [Error - 12:40:20] Restarting server failed
2024-05-15 12:40:20.562 [info]   Message: write EPIPE
  Code: -32099 
2024-05-15 12:40:20.563 [info] [Info  - 12:40:20] Connection to server got closed. Server will restart.
2024-05-15 12:40:20.563 [info] true
2024-05-15 12:40:20.590 [info] Traceback (most recent call last):
  File "/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/bundled/tool/lsp_server.py", line 17, in <module>

2024-05-15 12:40:20.590 [info]     from kedro.config import OmegaConfigLoader
ModuleNotFoundError: No module named 'kedro'

2024-05-15 12:40:20.594 [info] [Error - 12:40:20] Client Kedro: connection to server is erroring. Shutting down server.
2024-05-15 12:40:20.594 [info] [Error - 12:40:20] Stopping server failed
2024-05-15 12:40:20.594 [info] Error: Client is not running and can't be stopped. It's current state is: starting
    at w.shutdown (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/common/client.js:914:29)
    at w._serverProcess (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/common/client.js:889:30)
    at w.stop (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/node/main.js:152:38)
    at w.handleConnectionError (/Users/kacper.lesniara/.vscode/extensions/kedro.kedro-0.0.3/dist/webpack:/Kedro/node_modules/vscode-languageclient/lib/common/client.js:1147:67)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-05-15 12:40:20.594 [info] [Error - 12:40:20] Server initialization failed.
2024-05-15 12:40:20.594 [info]   Message: write EPIPE
  Code: -32099 
2024-05-15 12:40:20.594 [info] [Error - 12:40:20] Kedro client: couldn't create connection to server.
2024-05-15 12:40:20.594 [info]   Message: write EPIPE
  Code: -32099 
2024-05-15 12:40:20.594 [info] [Error - 12:40:20] Restarting server failed
2024-05-15 12:40:20.594 [info]   Message: write EPIPE
  Code: -32099 
2024-05-15 12:40:20.595 [info] [Error - 12:40:20] The Kedro server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Going into the project's .py files to activate the Python extension (to have the correct venv selected) and running kedro: Restart Server doesn't help.

Workaround:
I supplied the kedro.interpreter at the workspace level to point to the project's python executable with Kedro, restarted VSCode and it works. However, as this is a global solution (for the entire workspace), if I had multiple kedro, kedro-datasets versions across different projects some things may break potentially?

Potential fix / implementation:
Use kedro from the particular project's venv. Spin up multiple kedro-servers (one per project if needed). For inspiration - see how the mypy extension works. By default it uses global mypy, but specifying mypy.runUsingActiveInterpreter to true on a project-level enables using locally installed mypy

Info:
kedro == 0.19.5
python == 3.10.11
vscode-kedro == 0.0.3
Apple M2

@astrojuanlu
Copy link
Member

Thanks @Calychas for reporting this issue! It looks like that's enough information for us to try to reproduce. We'll get back to you soon.

@jitu5 jitu5 added the bug Something isn't working label Sep 24, 2024
@noklam noklam moved this to Todo in Kedro VS Code Sep 25, 2024
@astrojuanlu
Copy link
Member

Notice that the original issue was about multi-root workspaces with 1 Kedro project:

I have one project with Kedro (installed in venv) and multiple of other projects (each with its own venv) without it.

We will address this issue first.

However, we will think separately what should happen when there are several Kedro projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

3 participants