Eduard
Eduard

Reputation: 3522

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"

Upvotes: 8

Views: 12424

Answers (3)

juil
juil

Reputation: 2488

This option is available in the VS Code settings:

Open settings, search interpreter and you should get the option to set an option to set Python: Default Interpreter Path

Add the path to the default Python kernel you want to use and Jupyter Labs should always use this specified kernel moving forward.

Default Interpreter Setting

Upvotes: 2

CodeFarmer
CodeFarmer

Reputation: 2708

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 ?

Upvotes: 4

Steven-MSFT
Steven-MSFT

Reputation: 8411

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

Upvotes: 4

Related Questions