Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code - Jupyter notebook doesn't automatically select the default kernel

I have created a simple jupyter notebook in VS Code and selected it to use my default python3 kernel (/usr/local/bin/python3). Everything works great.

Then, I close VS Code and re-open the notebook, it asks me to select the kernel every time.

Is there a way to default the kernel of this notebook to my python3 interpreter?

In case it helps, when I view the notebook json, it has the following in it:

        "kernelspec": {
        "name": "python3",
        "display_name": "Python 3.9.6 64-bit"
like image 724
Eduard Avatar asked Apr 07 '26 08:04

Eduard


2 Answers

It's not available for now, but they think it is a reasonable request, and considering it. You can refer to this page.

like image 66
Steven-MSFT Avatar answered Apr 08 '26 20:04

Steven-MSFT


Two ways

one:

You can go into the command Juptyer: Filter Kernels

use command to filter out kernals, all kernals follow alphanumeric order. So, u can tick a few https://github.com/microsoft/vscode-jupyter/discussions/10130

two:

ps. Can try, but might not work after a while? idk why, but it works once.

Enforce choices to only 1, then reload vscode windows

"jupyter.kernels.filter": [
      {
        "path": "/bin/python3"
      }
    ]

Meanwhile you can visually browser all the paths on ur local Click the text button at the top right corner. <Python 3.x****>

It pops up like below

how to pick path ?

like image 39
CodeFarmer Avatar answered Apr 08 '26 20:04

CodeFarmer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!