Can't restart kernel in VSCode jupyter notebook

As the title says, recently notebooks in VSCode does not allow me to press restart kernel or interrupt (greyed out) and running the command “Julia: Restart kernel” results in the error

Command ‘Julia: Restart kernel’ resulted in an error (Running the contributed command: ‘language-julia:restartKernel’ failed.)

Tried it in jupyterlab and there it works fine, so seems to be with the VSCode plugin and not the kernel.

VSCode version 1.60.0 on fedora linux
jupyter extension version 2021.8.2041215044
julia extension version: 1.4.0

1 Like

Are you actually using the Jupyter kernel or the one built into the Julia extension?

Not sure, I selected Julia 1.6.2 from a list of kernels and I can see the path to my julia executable there also. But I’m not sure how I should know whether that goes through the extension or a jupyter kernel?

Also, the problem seems to have disappeared now so I’m not sure what is going on. Maybe just some local problem with my setup, but not sure what I did that fixed it…

I have the same issue. Which kernel should be used? :slight_smile:

Depends on whether you want to use Jupyter or not. If not, then use kernels annotated with “Julia VS Code extension”:

These you can stop/restart in the Julia workspace on the left.

Thanks. Actually, I’m not sure what to use. I’d just like to use the native notebook support from VSCode with Julia. Are you saying that I don’t have to install IJulia and Jupyter as shown here if I’m using VSCode?

Thanks for the very quick answer :slight_smile:

No. Don’t install anything apart from the Julia extension for VS Code and then explicitly enable julia.notebookController in the settings.

1 Like

Ok, since I’ve installed all that stuff to default environment v1.6, I created a new environment, but the notebook does not seem to respect the chosen environment from VSCode, according to Julia kernel not respecting environment selection · Issue #5666 · microsoft/vscode-jupyter ( Do I need an Pkg.activate(".") in the notebook?

It’s not clear which kernel you are using. I’d recommend uninstalling the Jupyter extension in VS Code, fwiw.

Jupyter extension is disabled for the workspace, is that sufficient?

The restart kernel now completely disappeared. That makes sense now, since I used the Kernel you proposed (the one annotated with Julia VS Code extension):

Given that, the native Julia notebook version (from Julia VSCode extension?) simply can’t restart the kernel currently? I think that’s fine for me, I was just confused because it seemed like a bug at first.

Is disabling the Jupyter extension and trying the native support the way to go in future?

Thanks for you help!

The notebook seems to activate automatically the current environment, pretty cool.

These you can stop/restart in the Julia workspace on the left.


Very cool. Is it recommended to disable Jupyter for Julia development (even with notebooks) in VSCode? What are the disadvantages? And - is that documented? :smiley: I think I’ve read a lot of docs, maybe a bit too many though.

Thanks :slight_smile:

Yes (ish), imho. The Jupyter extension isn’t strictly necessary since most of the UI has moved into VS Code core and can mess things up (e.g. output rendering might not be up to snuff etc pp).

The Notebook experience in the Julia extension is pretty new, so we don’t support everything and there probably are a bunch of bugs.

Haha, no.

1 Like

Okay, I tried the setting you mentioned and had not set that, so I was using the standard jupyter notebook environment. Testing it out now and it is looking really nice with the environments collected in the julia workspace.

1 Like

Can report some buggy behavior for the julia extension kernels. It seems that multiple kernels started for my notebook somehow, and the restart and stop buttons are not responding for all but the “latest” version of the kernel. Seems like it somehow lost contact with the older kernels and started new ones, but all were still visible in the julia workspace and they were using resources in the background. They did disappear after restarting vscode.