question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong kernel name in metadata kernelspec when using kernel from virtualenv

See original GitHub issue

Environment 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:closed
  • Created 2 years ago
  • Comments:22 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Feb 15, 2022

No apologies necessary, glad that you were able to verify this and get back to us. Thanks again for the confirmation.

1reaction
pplonskicommented, Feb 15, 2022

@DonJayamanne sorry for the confusion. I’ve started VS Code after machine restart and looks like it is working!

vs-code-reproduce

Thank you very much! Closing the issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found