Jupyter not respecting pre-set kernel in notebook metadata
See original GitHub issueEnvironment data
- VS Code version: 1.63.2
- Jupyter Extension version (available under the Extensions sidebar): v2021.11.1001550889
- Python Extension version (available under the Extensions sidebar): v2021.12.1559732655
- OS (Windows | Mac | Linux distro) and version: Windows 10 19042.1348
- Python and/or Anaconda version: Python 3.6.8
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Jupyter server running: Local | Remote | N/A : Both Local and Remote
Expected behaviour
Jupyter Extension respects defined kernel in the *.ipynb file metadata
Actual behaviour
For each folder I open, I must re-select the kernel before executing.
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- Create new notebook, and select kernel.
- Save notebook with kernel selected
- Move notebook to another folder
- Open new folder in VSCode and open the notebook.
- See if kernel is still selected
Example of notebook file in txt form after saving kernel
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
I tried to find another issue discussing this, but didn’t find an exact match.
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Change Default kernel in jupyter notebook - Stack Overflow
Open the notebook. Then navigate to Kernel -> Change Kernel and select the kernel you want to use. The question was specifically for...
Read more >Making kernels for Jupyter — jupyter_client 7.4.8 documentation
Making kernels for Jupyter . A 'kernel' is a program that runs and introspects the user's code. IPython includes a kernel for Python...
Read more >Working with Jupyter Notebooks in Visual Studio Code
View, inspect, and filter variables using the Variable Explorer and Data Viewer; Connect to a remote Jupyter server; Debug a Jupyter Notebook. Setting...
Read more >The Jupyter Notebook Format — IPython 3.2.1 documentation
Jupyter (né IPython) notebook files are simple JSON documents, ... While the type and values of some metadata are defined, no metadata values...
Read more >How to Version Control Jupyter Notebooks - Nextjournal
Jupyter notebooks generate files that may contain metadata, source code, ... The JSON data above renders the following result in Jupyter Notebook:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After a bunch of discussion here on the team, it was decided that the current shipping behavior should remain for now. The main reasons are:
Thanks for the bug.
VS code doesn’t actually allow us to specify a specific kernel to set the first time it sees a notebook, but we can probably trick it by forcing a selection.
I’m rather surprised nobody else has logged this yet. I can’t find a dupe though.