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

{connection_file} argument not passed to Jupyter kernel #7203

Closed
taisbak opened this issue Aug 19, 2021 · 10 comments
Closed

{connection_file} argument not passed to Jupyter kernel #7203

taisbak opened this issue Aug 19, 2021 · 10 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) verified Verification succeeded
Milestone

Comments

@taisbak
Copy link

taisbak commented Aug 19, 2021

Similar, but maybe not the same as issue #7063 Kernelspecs with non-default arguments don't work.

Environment data

  • VS Code version: 1.60.0-insider (user setup)
  • Jupyter Extension version (available under the Extensions sidebar): 2021.8.2028630014
  • Python Extension version (available under the Extensions sidebar): 2021.9.1144093763-dev
  • OS (Windows | Mac | Linux distro) and version: Windows 10.0.18363
  • Python and/or Anaconda version: python: 3.8.11 / miniconda 4.10.3
  • Type of virtual environment used: N/A
  • Jupyter server running: Local
  • Jupyter kernel: Ganimede 1.1.0.20210614 (Java 16)

Expected behaviour

  • Connect to Ganimede kernel and execute notebook code - this works when running the notebook using the anaconda provided jupyter notebook application.

Actual behaviour

  • Connection fails
  • Error 2021-08-19 14:24:55: Failed to connect raw kernel session: Error: Connection file not found in kernelspec json args, C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe --illegal-access=permit --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -jar C:\Users...\AppData\Roaming\jupyter\kernels\ganymede-1.1.0.20210614-java-16\kernel.jar --runtime-dir=C:\Users\stais\AppData\Roaming\jupyter\runtime --connection-file={connection_file}

Apparently the {connection_file} argument is not passed properly.

Steps to reproduce:

  1. Download and install the Ganimede kernel as described here: github.com/allen-ball/ganymede which will add it to your current Jupyter installation.
    NOTE: the installation uses the "which" command, which does not exist on Windows. Copying "where.exe" to "which.exe" made it work.
  2. Create a new notebook in VSCode and choose Ganymede as the kernel.
  3. Write some code, e.g.: System.out.println("hello");
  4. Run it ... you'll get the above error
@taisbak taisbak added the bug Issue identified by VS Code Team member as probable bug label Aug 19, 2021
@DonJayamanne
Copy link
Contributor

Thanks for filing this issue, i can replicate this at my end, will look into getting this fixed.

@rchiodo
Copy link
Contributor

rchiodo commented Aug 20, 2021

@DonJayamanne is the PR done?

@greazer greazer added the notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) label Aug 23, 2021
@DonJayamanne
Copy link
Contributor

DonJayamanne commented Aug 23, 2021

@taisbak
I believe I have fixed this issue. Please could you try the following to validate the fix:

Note: I"d like to get this validated before we merge this change into the main branch for the release.

@taisbak
Copy link
Author

taisbak commented Aug 24, 2021

@DonJayamanne, thank you for the fast response.

  • Installed the provided VSIX:
    image

  • Ganymede seems to get started OK.

  • However, the Notebook hangs, when I try to run the code (I restarted everything, including my laptop):
    image

  • The output log does not provide anything useful:
    image

  • Other logs are empty.

  • It is using a lot of CPU:
    image

  • Please let me know what other information you need.

@taisbak
Copy link
Author

taisbak commented Aug 24, 2021

Maybe I've spotted the problem.
The -jar argument in Kernel.json has been changed from C:\users\me\Appdata... to ~\Appdata... which doesn't seem to work.
Kernel.json:
{
"argv": [
"java",
"--illegal-access=permit",
"--add-opens",
"java.base/jdk.internal.misc=ALL-UNNAMED",
"-jar",
"C:\\Users\\stais\\AppData\\Roaming\\jupyter\\kernels\\ganymede-1.1.0.20210614-java-16\\kernel.jar",
"--runtime-dir=C:\\Users\\stais\\AppData\\Roaming\\jupyter\\runtime",
"--connection-file={connection_file}"
],
"display_name": "Ganymede 1.1.0.20210614 (Java 16)",
"env": {},
"interrupt_mode": "message",
"language": "java"
}

@taisbak
Copy link
Author

taisbak commented Aug 24, 2021

Further the slash in "java.base/jdk.internal.misc=ALL-UNNAMED" is changed to a back-slash: "java.base\jdk.internal.misc=ALL-UNNAMED" though it's not a filename.

@DonJayamanne
Copy link
Contributor

Thanks for the feedback.
I'm a little confused.
Is the kernelspec above from the disc, if thats the case, then we don't modify it. I'm assuming what you're trying to say is that it was generated incorrectly by what ever tool generated it. is that right?

If not, please could you provide the logs from the Jupyter Output panel so i can see what's going on.
Thanks again for your help validating this fix.

@taisbak
Copy link
Author

taisbak commented Aug 25, 2021

Sorry for the confusion.

This is the Jupyter Output:
image

Pasting the command into the terminal window produces the following output:
image

Changing the filepath from ~ to it's full name in the terminal window:
image

Changing the back-slash to slash in "--add-opens java.base\jdk.internal.misc=ALL-UNNAMED" in the terminal window gives
image

This led me to think that the arguments in the argv array from KernelSpec.json are being modified on their way. It should only be {connection_file} being changed to the relevant file name, which seems to be done correctly. The other arguments should be left unchanged.

But I don't know where it's happening. Just that the same KernelSpec.json works fine with Jupyter Lab.

@taisbak
Copy link
Author

taisbak commented Aug 26, 2021

I have tried to look further into the problem.

It might be that the slashes are only changed to back-slash when displayed, though I would rather see the actual value.

Further it looks like the kernel actually gets started but doesn't communicate with the client.

Is there a way to capture output from the kernel itself?

When run as an anaconda jupyter notebook it writes the following output to the console:

image

@taisbak
Copy link
Author

taisbak commented Aug 26, 2021

Sorry for my contemplations being messy.

Looking at it, it it is clear that your fix did fix the stated problem.

And led to the next.

I'll close this and file another issue about the communication problems.

Thank you and my apollogies.

@taisbak taisbak closed this as completed Aug 26, 2021
@roblourens roblourens added the verified Verification succeeded label Aug 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants