# Can't restart kernel in VSCode jupyter notebook

**URL:** <https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136>\
**Category:** VS Code\
**Tags:** jupyter\
**Created:** [September 14, 2021, 9:40am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136 "2021-09-14T09:40:17Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [September 14, 2021, 9:40am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/1 "2021-09-14T09:40:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 14, 2021, 9:41am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/2 "2021-09-14T09:41:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [September 14, 2021, 9:50am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/3 "2021-09-14T09:50:52Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![JanKap](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jankap/32/22763_2.png) [@JanKap](https://discourse.julialang.org/u/JanKap)\
**Post date:** [September 16, 2021, 9:35am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/4 "2021-09-16T09:35:18Z")

</div>

I have the same issue. Which kernel _should_ be used? 🙂

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 16, 2021, 9:36am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/5 "2021-09-16T09:36:50Z")

</div>

Depends on whether you want to use Jupyter or not. If not, then use kernels annotated with “Julia VS Code extension”:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/6/06968f87103dba26d176ac8daebcd509042b9b5b.png)

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

---

<div class="post-metadata">

**Author:** ![JanKap](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jankap/32/22763_2.png) [@JanKap](https://discourse.julialang.org/u/JanKap)\
**Post date:** [September 16, 2021, 9:42am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/6 "2021-09-16T09:42:25Z")

</div>

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](https://julialang.github.io/IJulia.jl/stable/manual/installation/) if I’m using VSCode?

Thanks for the very quick answer 🙂

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 16, 2021, 9:45am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/7 "2021-09-16T09:45:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JanKap](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jankap/32/22763_2.png) [@JanKap](https://discourse.julialang.org/u/JanKap)\
**Post date:** [September 16, 2021, 9:57am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/8 "2021-09-16T09:57:27Z")

</div>

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 (github.com)](https://github.com/microsoft/vscode-jupyter/issues/5666). Do I need an `Pkg.activate(".")` in the notebook?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 16, 2021, 10:00am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/9 "2021-09-16T10:00:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JanKap](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jankap/32/22763_2.png) [@JanKap](https://discourse.julialang.org/u/JanKap)\
**Post date:** [September 16, 2021, 10:07am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/10 "2021-09-16T10:07:35Z")

</div>

Jupyter extension is disabled for the workspace, is that sufficient?  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/9/b91b6df3e816e6f8d6dfa399e1d9860e52241e21.png)

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`):  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/b/4b3850ca60500393656ff510b6823481f3b2f951.png)

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!

edit:  
The notebook seems to activate automatically the current environment, pretty cool.  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/7/37e275a6a4f185b411969b8593c3d0a505ece7d0.png)

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 16, 2021, 10:09am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/11 "2021-09-16T10:09:10Z")

</div>

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

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/8/58a356496492a4b0f2b6e32ad686527c3162e7fd.png)

---

<div class="post-metadata">

**Author:** ![JanKap](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jankap/32/22763_2.png) [@JanKap](https://discourse.julialang.org/u/JanKap)\
**Post date:** [September 16, 2021, 10:14am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/12 "2021-09-16T10:14:49Z")

</div>

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

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 16, 2021, 10:16am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/13 "2021-09-16T10:16:59Z")

</div>

> [@JanKap](#):
>
> Is it recommended to disable Jupyter for Julia development (even with notebooks) in VSCode?

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).

> [@JanKap](#):
>
> What are the disadvantages?

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

> [@JanKap](#):
>
> And - is that documented? 😃

Haha, no.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [September 17, 2021, 2:10pm UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/14 "2021-09-17T14:10:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [September 22, 2021, 9:50am UTC](https://discourse.julialang.org/t/cant-restart-kernel-in-vscode-jupyter-notebook/68136/15 "2021-09-22T09:50:04Z")

</div>

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.
