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

Add a default kernel option to settings.json #130946

Closed
JILPulvino opened this issue Aug 13, 2021 · 22 comments
Closed

Add a default kernel option to settings.json #130946

JILPulvino opened this issue Aug 13, 2021 · 22 comments
Assignees
Labels
feature-request Request for new features or functionality notebook-kernel verification-needed Verification of issue is requested verified Verification succeeded

Comments

@JILPulvino
Copy link

Perhaps the wrong venue to request this, but it would be great to have a default kernel setting for the settings.json file.

see this SO question: https://stackoverflow.com/questions/67516550/vs-code-how-do-i-select-jupyter-kernel-for-a-workspace

@DonJayamanne
Copy link
Contributor

Thanks for the suggestion we'll discuss this in our next triage meeting.

@greazer greazer transferred this issue from microsoft/vscode-jupyter Aug 16, 2021
@greazer
Copy link
Member

greazer commented Aug 16, 2021

Thanks for the feedback, @JILPulvino. Setting a default kernel for a workspace is a reasonable request. We'll consider it! BTW, it's related to #114663

@DonJayamanne
Copy link
Contributor

Related issues #131370, #131369

@joshdunnlime
Copy link

This is backlogged but I would like to reopen it. How can I do that?

@MSZeftawy
Copy link

Is there a deadline for adding this feature?

@patgratt
Copy link

would love for this to get implemented!

@srosenzweig09
Copy link

Looking forward to this feature!

@claudiaregio
Copy link

+1

@GoldEagle93
Copy link

Needed!

@shredder67
Copy link

+1 for this feature

@lee-uidam
Copy link

looking forward to it! Loses remote jupyter conn after sleep mode :(

@ilovejs
Copy link

ilovejs commented Sep 21, 2022

alternatively,

force one and only one chose :)

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

@yanyu2015
Copy link

alternatively,

force one and only one chose :)

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

why my config does‘t works?

    "jupyter.kernels.filter": [
        {
          "path": "F:\\ADS\\Pys\\anaconda\\python.exe"
        }
    ]

@jtkiley
Copy link

jtkiley commented Aug 18, 2023

There are similar discussions about default kernels in devcontainers, for many of the same reasons.

See:

@maggieroot39
Copy link

Hi, is there any expectation on when this issue might be picked up?

@JosephDHenry
Copy link

The default python environment used to be picked by default, but a while ago its just stopped working and this is very inconvenient.

@Kradirhamik
Copy link

Interested in this as well

@cosmic-latte
Copy link

This is a reasonable and frequently used feature.

@PierXuY
Copy link

PierXuY commented Oct 22, 2023

Interested in this, looking forward to it.

@oscar-wos
Copy link

oscar-wos commented Oct 29, 2023

I was running Windows 10, with WSL Debian 10, Python3.9, I had all the extensions installed (Python / Jupyter / WSL) and the kernel would be instantly picked, however now with Windows 11, WSL Debian 12, Python3.11 same extensions, I have to manually reselect the kernel for each new notebook I open.

The install process had only 1 alteration, pip install ipykernal --break-system-packages would yield:

ERROR: Could not find a version that satisfies the requirement ipykernal (from versions: none)
ERROR: No matching distribution found for ipykernal

which I manually overrode with:

pip install ipykernel==6.26.0 --break-system-packages

I have added the defaultInterpreterPath as /usr/bin/python3.11 in both the workspace and WSL with no avail.

It seems that each notebook is now also assigned it's own kernel instance. I used to only have 1 active port for all my notebooks, now it's incrementing for each notebook I open.

@rpm5099
Copy link

rpm5099 commented Oct 31, 2023

Maybe this will also fix the problem of reconnecting to a jupyter kernel after reloading the window - it seems that the extension tries to reconnect to the same jupyter kernel URL (which no longer exists) instead of just using the base url that you put in when it asked which jupyter server you wanted to use.

  response: F [Response] {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
    [Symbol(Response internals)]: {
      url: 'https://[jupyter url]/api/kernels?1698785875946',
      status: 403,
      statusText: 'Forbidden',
      headers: [D [Headers]],
      counter: 0
    }

@DonJayamanne
Copy link
Contributor

Solutions

1. Hide all of the Python environments except the one you need

  • If you have n python environments and you only use one, then hide all of the others.
  • If you have just Jupyter and Python extension, then the remaining Python env will be automatically selected (however if you have other remote jupyter kernels, or other extensions that contribute kernels, then this will not get selected automatically). Please see solution 2.
  • Open a Jupyter ntoebook (to ensure the Jupyter extension gets activated)
  • Open your settings.json file
  • Add the setting "jupyter.kernels.excludePythonEnvironments": [...] and add the environments you wish to hide.

See here microsoft/vscode-jupyter#13032 (comment)

2. Install the extension Default Python Kernels for Jupyter Notebooks

From here on, all notebooks opened will have the active Python environment selected as the kernel.
You can change the Active Python Environment for your workspace/globally using the command Python: Select Interpreter

You can find more information on the read me of the above extension.

@DonJayamanne DonJayamanne modified the milestones: Backlog, December / January 2024 Jan 18, 2024
@aiday-mar aiday-mar added the verification-needed Verification of issue is requested label Jan 24, 2024
@amunger amunger added the verified Verification succeeded label Jan 24, 2024
@aiday-mar aiday-mar added this to the December / January 2024 milestone Feb 6, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality notebook-kernel verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests