Wrong kernel name in metadata kernelspec when using kernel from virtualenv
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: Ubuntu 18.04
- Python: Python 3.8
- Type of virtual environment used: virtualenv
- Jupyter server running: Local
Expected behaviour
I created a new virtual environment with the name venv_2.
virtualenv venv_2 --python=python3.8
I add kernel to that venv:
python -m ipykernel install --user --name=venv_2
I created a new ipynb file in the VS Code and select kernel to venv_2 in the top right corner.
When I check the file of the notebook in the text editor I see the wrong kernelspec in metadata, it has name set to python3 but it should be set to venv_2.
The contents of the notebook:
... the rest of the notebook ...
"metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.0 64-bit ('venv_2': virtualenv)",
   "language": "python",
   "name": "python3"
  },
It should be
... the rest of the notebook ...
"metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.0 64-bit ('venv_2': virtualenv)",
   "language": "python",
   "name": "venv_2"
  },
Issue Analytics
- State:
- Created 2 years ago
- Comments:22 (16 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
jupyter notebook running kernel in different env - Stack Overflow
The solution was to activate the WSL extension: lower right corner > click on the arrows (Open a remote connection) > reopen folder...
Read more >Making kernels for Jupyter — jupyter_client 7.4.8 documentation
At kernel startup, Jupyter passes the kernel a connection file. This specifies how to set up communications with the frontend. There are three...
Read more >ipython kernel install python3.10 - You.com | The AI Search ...
Below is the message I receive when I try to install ipykernel with the following command: conda install -c anaconda ipykernel.
Read more >venv-kernel - PyPI
This package creates jupyter kernels for the venv it is installed in. Use-case scenario. You maintain multiple virtual environments via python's venv or...
Read more >Github Actions – Water Programming
2: Automated build & deploy with GitHub Actions ... python -m ipykernel install --user --name=.venv. # install R ... update kernel metadata.
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

No apologies necessary, glad that you were able to verify this and get back to us. Thanks again for the confirmation.
@DonJayamanne sorry for the confusion. I’ve started VS Code after machine restart and looks like it is working!
Thank you very much! Closing the issue.