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

Preferred Python Notebook Kernel #9615

Closed
DonJayamanne opened this issue Apr 7, 2022 · 3 comments
Closed

Preferred Python Notebook Kernel #9615

DonJayamanne opened this issue Apr 7, 2022 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) notebook-getting-started

Comments

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Apr 7, 2022

This issue focuses on suggestions/ideas that can help improve the preferred/suggested kernel for Python Notebooks & Interactive Window.

Problems faced by users with regards to kernel selection?

  • Active Python interpreter (default kernel in Notebook/IW) does not have ipykernel dependencies installed.
  • User selects a Python kernel which does not have ipykernel dependencies installed.
    • Work arounds:
      • Keep trying until something works. However if one doesn't keep track of the kernel, they end up in the same situation again when opening a new notebook.
      • If they are an existing Jupyter user, then look for that same environment in the list (I would assume more advanced user would try this).
  • User ends up selecting a Python kernel which does not the user dependencies (tensorflow, pandas, etc) installed.
    • I.e. the user tries something out in Jupyter or the terminal. And then hear about VS Code and attempt to try something in VS Code, but things wont work here as the Python environment used is not the same.
  • User knows that a specific kernel works, and need to search for this kernel again & again when creating new notebooks
    • Basically when you open a notebook and hit Run, you have to go through the kernel list to pick the right item, & it could be 1/2 way down the list.

Summary of the problems:

  • Takes longer to get started,
  • End user confusion (why are they getting prompts, what is ipykernel, what is a kernel, why do i need to install, things work in terminal, etc)
  • The likely-hood of things not working in Jupyter extension increases with the number of Python environments.
  • Starting with new notebooks always takes time, as one needs to search for the right kernel everytime

Suggestions

  • Add hints to kernel picker to indicate which Python environments have IPyKernel (user request)
  • For new Notebooks recommend the kernel that was last selected in a new notebook (user request)
  • If conda has been activated in a terminal and VS Code launched from a terminal use that conda env
  • Auto select the base environment from Conda as the preferred kernel
    • Why?: Assumption is that if a user has conda installed, then they use conda most of the time & expect the same env to be used elsewhere (i.e. when the launch the terminal, they always use the same base conda env). Note: the default base can be configured in conda.
    • Default and/or suggest environment for new notebooks #9115
  • The default Python environment that's available in the terminal (current PATH variable) is not the same as the default in VS Code.
    • Why? User runs code in the terminal and things work, Now they go into VS Code and the active interpreter is not the same as the default, hence things won't necessarily work as expected. Now the user needs to learn to pick the right kernel.
    • Jupyter notebooks not using Python in current path #5998
  • Allow users to select an item from the kernel list as the default (preferred) for notebooks
    • How will this work if Jupyter extension nominates a kernel as the preferred? Which takes precedence?
    • How can a user manage this? If they select something as a default, how do they re-set this? Do they need to?
  • Create a blessed Python environment with everything in it
    • Create a Python environment that has all of the dependencies and promote this as the preferred kernel.
  • There are too many kernels, hence we need to allow users to filter/exclude items from the list
    • We ended up adding the ability to filter/exclude kernels from the dropdown list.
  • If the preferred kernel doesn't work, then don't mark that kernel as the preferred kernel until and unless we know it works (next time)

Legend:

IW Python Interactive Window
Notebook Python Jupyter Notebook
IPyKernel Python package required by Jupyter to start a Jupyter kernel inside a specific Python environment
@DonJayamanne DonJayamanne added the bug Issue identified by VS Code Team member as probable bug label Apr 7, 2022
@microsoft microsoft locked and limited conversation to collaborators Apr 7, 2022
@greazer greazer added this to the May 2022 milestone Apr 7, 2022
@greazer greazer added notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) kernel-enumeration and removed needs-triage labels Apr 7, 2022
@DonJayamanne
Copy link
Contributor Author

See upstream Python work for related work microsoft/vscode-python#18178

@IanMatthewHuff
Copy link
Member

@rchiodo rchiodo modified the milestones: May 2022, June 2022 Jun 1, 2022
@IanMatthewHuff IanMatthewHuff modified the milestones: June 2022, July 2022 Jun 30, 2022
@greazer greazer removed this from the July 2022 milestone Jul 8, 2022
@IanMatthewHuff IanMatthewHuff removed their assignment Nov 10, 2022
@DonJayamanne DonJayamanne self-assigned this Nov 14, 2022
@DonJayamanne
Copy link
Contributor Author

Closing in favour of #12274

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) notebook-getting-started
Projects
None yet
Development

No branches or pull requests

4 participants