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

VSCode cannot use Jupyter kernels that use {resource_dir} in their kernel.json #16344

Open
1 of 2 tasks
emcastro opened this issue Dec 27, 2024 · 0 comments
Open
1 of 2 tasks
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@emcastro
Copy link

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

VSCode cannot use Jupyter kernels that use {resource_dir} in their kernel.json.
For instance, standard deployment of JJava kernel (https://github.com/dflib/jjava)

The kernel file is as this:

{
    "argv": [
        "java",
        "-jar",
        "{resource_dir}/jjava-launcher.jar",
        "{resource_dir}/jjava.jar",
        "{connection_file}"
    ],

At first use, the kernel dies:

 [error] Error in execution (get message for cell) Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar...

The {resource_dir} is not properly translated.

Workaround
Transform {resource_dir} by and after installation. E.g:

sed -i "s|{resource_dir}|$HOME/.local/share/jupyter/kernels/java|g" "${HOME}/.local/share/jupyter/kernels/java/kernel.json"

VS Code Version

Version: 1.96.2 (user setup) Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f Date: 2024-12-19T10:22:47.216Z Electron: 32.2.6 ElectronBuildId: 10629634 Chromium: 128.0.6613.186 Node.js: 20.18.1 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.22631

Jupyter Extension Version

2024.11.0

Jupyter logs

13:44:07.750 [info] Dispose Kernel '~/osm-e1/xtest.ipynb' associated with '~/osm-e1/xtest.ipynb'
13:44:07.778 [info] Starting Kernel (Java (jjava)) for '~/osm-e1/xtest.ipynb' (disableUI=true)
13:44:07.800 [info] Launching Raw Kernel Java (jjava) # java
13:44:07.812 [info] Process Execution: /java -jar {resource_dir}/jjava-launcher.jar {resource_dir}/jjava.jar /home/~/.local/share/jupyter/runtime/kernel-v34c36676949f8c09a1d27141a6bc8cb94c4e99d28.json
    > cwd: //home/~/osm-e1
13:44:07.824 [error] Disposing kernel process due to an error Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)
13:44:07.829 [error] Failed to connect raw kernel session: Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
13:44:07.830 [error] Failed to connect raw kernel session: Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
13:44:07.830 [warn] Failed to shutdown kernel, .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file} TypeError: Cannot read properties of undefined (reading 'dispose')
    at $_.shutdown (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:304:13745)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at q_.shutdown (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:304:22578)
13:44:07.833 [warn] Error occurred while trying to start the kernel, options.disableUI=true Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)
13:44:11.841 [info] Starting Kernel (Java (jjava)) for '~/osm-e1/xtest.ipynb' (disableUI=false)
13:44:11.857 [info] Launching Raw Kernel Java (jjava) # java
13:44:11.874 [info] Process Execution: /java -jar {resource_dir}/jjava-launcher.jar {resource_dir}/jjava.jar /home/~/.local/share/jupyter/runtime/kernel-v39590b76105a93f9c667e15403b86a5248838a056.json
    > cwd: //home/~/osm-e1
13:44:11.883 [error] Disposing kernel process due to an error Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)
13:44:11.884 [error] Failed to connect raw kernel session: Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
13:44:11.884 [error] Failed to connect raw kernel session: Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
13:44:11.885 [warn] Failed to shutdown kernel, .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file} TypeError: Cannot read properties of undefined (reading 'dispose')
    at $_.shutdown (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:304:13745)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at q_.shutdown (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:304:22578)
13:44:11.886 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)
13:44:11.887 [warn] Kernel Error, context = start Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)
13:44:11.897 [info] Dispose Kernel '~/osm-e1/xtest.ipynb' associated with '~/osm-e1/xtest.ipynb'
13:44:11.899 [error] Error in notebook cell execution Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)
13:44:11.902 [error] Error in execution (get message for cell) Error: The kernel died. Error: Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .java./java./.java#-jar#{resource_dir}/jjava-launcher.jar#{resource_dir}/jjava.jar#{connection_file}
    > at ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847)
    > stdErr = Error: Unable to access jarfile {resource_dir}/jjava-launcher.jar
    > vslsStack = ChildProcess.<anonymous> (/home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.11.0-linux-x64/dist/extension.node.js:299:44847),ChildProcess.emit (node:events:530:35),ChildProcess._handle.onexit (node:internal/child_process:293:12)

Coding Language and Runtime Version

Java 17

Language Extension Version (if applicable)

JJava 1.0-a

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

@emcastro emcastro added the bug Issue identified by VS Code Team member as probable bug label Dec 27, 2024
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
Projects
None yet
Development

No branches or pull requests

2 participants