It's because there is an extra step needed - you need to explicitly install a Jupyter kernel that points to your new Python virtual environment. You can't simply activate Jupyter-lab or Notebook from the virtual environment. This has tripped me up before, too.

Follow the advice here: Using Jupyter notebooks with a virtual environment

And, in fact, there can be an issue where your kernel still doesn't point to the correct Python binary, in which case you need to change one suggestion in the above advice process:

From: ipython kernel install --user --name=projectname

To: python3 -m ipykernel install --user --name=projectname

where projectname is the name of the venv to use as the ipython kernel.

(This correction comes from a comment to Jupyter Notebook is loading incorrect Python kernel #2563.)

*and don't forget to restart VSCode

Answer from rocksteady on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › no kernel dropdown when trying to run jupyter in vscode
r/learnpython on Reddit: No kernel dropdown when trying to run Jupyter in VSCode
August 27, 2025 -

Hi. I'm trying to run some code in a Jupyter notebook in VSCode. Whenever I try to do this, I get a pop up that asks me to select a kernel. I also see this is written on the top right of the window I'm in. The problem is that there is nothing in this dropdown menu, and I therefore cannot run anything.

I am running VSCode with the Python and Jupyter extensions installed. I've created a virtual environment and installed ipykernel. I've also tried to install jupyter to see if that helped, but it didn't. And yes, the environment is selected (by opening the menu in VSCode, selecting "Select Python interpreter" and picking the Python-binary in .venv). I've rebooted my machine and reinstalling the extensions, yet it does not solve the issue. Running normal python files works fine.

Any tips? Cheers.

🌐
Visual Studio Code
code.visualstudio.com › docs › datascience › jupyter-kernel-management
Manage Jupyter Kernels in VS Code
November 3, 2021 - By default, VS Code will recommend the one you've previously used with your notebook, but you can choose to connect to any other Jupyter kernels as shown below. VS Code will also remember the last selected kernel for your notebooks, and will automatically select them the next time you open your notebook.
🌐
Reddit
reddit.com › r/learnpython › python interpreter, jupyter kernel, and virtual environments
r/learnpython on Reddit: Python interpreter, Jupyter kernel, and virtual environments
August 28, 2024 -

I’m learning Python to do the data work I normally do with R and have been using VSCode. Since I don’t come from a comp sci background, there are some things that are pretty foreign to me, but I’m slowly getting a grasp of them.

I think I figured out virtual environments, but I’m confused on selecting a Python interpreter and Jupyter kernel in VScode - do I have to select the Python interpreter from my virtual environment, or can I just use whatever VSCode recommends? And do I really have to do this every time I open up VSCode?

Edit: also, my virtual environment has 3 Python interpreters I can choose - python, python3, and python3.12. What do I choose and why?

And what the hell is a Jupyter kernel? Do kernels always need to be installed in the same place as the virtual environment I’m using?

TIA, y’all were incredibly helpful in my last post

Top answer
1 of 3
1
I’m a PyCharm user so might have some inaccuracies but you should be using the interpreter from the virtual environment you’ve created to be used with your project. You should specify per VSCode project which interpreter in the virtual environment should be used and it should automatically use that whenever working in the project. I guess I’m a bit confused but it might depend on the environment tool but I use Poetry and there’s only one interpreter associated with it to use. The python and python3 you are finding might be system pythons which you shouldn’t touch. You can look up their location and verify whether they’re in the environment or not. Jupyter kernels are a process which runs whatever you’re doing in the Jupyter notebook. They will also use a specific interpreter of your choosing. If the notebook is associated with a project, you should choose the interpreter for that project’s associated virtual environment. As an aside, this is one of the most confusing parts of Python. I’ve used pyenv, virtualenv, conda, pipenv, and poetry to set up environments. None of them can do it all and they should be used in combination and there’s little agreement on which is best and what consensus there is, changes over time. When Pipenv came out, it was supposed to solve a lot of problems conda had but then it fell into disrepair and so many moved to Poetry which I think is the current consensus best tool
2 of 3
1
When you say you have 3 interpreters for your virtual environment, I believe you mean when you are using a vscode extension to create a venv, it allows you to choose 1 of the 3 python versions you have installed on your system. Id chose the most recent one (3.12) unless you need to use some functionality that is deprecated. When using jupyter, you are usually working in a notebook GUI such as IPython, collab, the juptyer interactive terminal extension in vscode, and many others, these can range quite a bit in what they are good for and what functionality they provide and are mostly developed by independent sources and therefore require different apis/kernels to convert your commands. VScode uses the ipykernel (the same for IPython) and should have been installed with your Jupyter extension so you shouldn't need to specify its location unless it was misconfigured. To answer the question of if the kernel needs to be installed for each venv, it depends, usually not because the vscode extensions are almost always separate from your environments and you can specify which ones to enable/disable for each workspace and/or env. However it is possible to configure it such that different kernels and versions of extensions are used in different workspaces and/or venvs, in which case you would need manually specify the paths when creating the workspace/venv. Note that workspaces are different than venvs but its best practice to have 1 workspace for each venv or configure a more complicated multi-workspace if you need to use multiple languages or language versions for a single project.
🌐
GitHub
github.com › astral-sh › uv › issues › 6672
uv .venv and VS Code Jupyter Notebook: Connecting to Kernel · Issue #6672 · astral-sh/uv
August 27, 2024 - I was hoping to be able to use VS Code Jupyter notebooks with just uv to install Python. Loading the .venv works fine, but when running a code block, it is stuck in an infinite loop trying to connect to a Kernel. This only happens with VS Code Jupyter Notebooks as well.
Author   wes-stone
Find elsewhere
🌐
Reddit
reddit.com › r/vscode › jupyter notebook cannot accept venv in vs code
r/vscode on Reddit: Jupyter Notebook cannot accept venv in VS Code
February 3, 2025 -

I have problems in getting Jupyter Notebook to use a virtual environment I created. With just Python code, venv works great. But when I use Jupyter Notebook, it does not accept the venv environment I choose. In other words, after I do Control-Shift-P and select Python virtual environment from a location, it still uses the system Python version. The following is a screenshot.

🌐
Medium
medium.com › @temperancehong0 › add-venv-to-your-jupyter-kernel-with-vs-code-c91c36ae484e
Add .venv to your Jupyter Kernel with VS Code | by Temperancehong | Medium
August 7, 2025 - Add .venv to your Jupyter Kernel with VS Code In case of non detection of .venv in your notebook with the select kernel, these are some steps to check: Put your .venv in the Python interpreter In …
🌐
Process Street
process.st › home › miscellaneous › how to setup a jupyter notebook in vs code (virtual env + kernels)
How To Setup a Jupyter Notebook in VS Code (Virtual Env + Kernels) | Process Street
June 18, 2024 - Type in & choose: “Create: New Jupyter Notebook” · Step 6.2: Choose your kernel · Open the VSCODE search bar: cmd+shift+p · Type in & choose: “Notebook: Select Notebook Kernel” · At the bottom of VSCode, you should see “Jupyter ...
🌐
Medium
medium.com › @marcio.debarros › a-seamless-transition-setting-up-virtual-environment-and-jupyter-notebooks-in-vs-code-6debf9078ddd
A Seamless Transition: Setting up Virtual Environment and Jupyter Notebooks in VS Code | by Marcio DeBarros | Medium
April 22, 2025 - For the longest time, for any Python experiment I wanted to do, I either went with PyCharm for standard Python projects or Jupyter Notebooks for Notebooks. This involved managing different Python versions with pyenv, using virtualenv to create virtual environments, and manually creating different kernels for Jupyter Notebooks.
🌐
GitHub
github.com › microsoft › vscode-jupyter › issues › 5319
New Virtual environments not listed in Kernels until i reload VS Code · Issue #5319 · microsoft/vscode-jupyter
March 25, 2021 - Run notebook, & view kernels Create virtual environment Close notebook, open a notebook, the new venv is not dipslayed in the kernel picker Need to reload
Author   DonJayamanne
🌐
Reddit
reddit.com › r/learnpython › how to use venv in vscode, to run python scripts.
r/learnpython on Reddit: How to use venv in VSCODE, to run python scripts.
June 27, 2024 -

First, I launch Visual Studio Code (VSCode), establish a virtual environment (venv), and set up the necessary directories. I then proceed to install the required dependencies. When it comes to executing a .pynb file within this venv, I can employ a command-line instruction to view and interact with the Jupyter notebook in Google Chrome, allowing me to run the cells seamlessly.

However, when I attempt to open the same notebook in VSCode, I encounter an issue: the venv environment I created does not appear as an option for running the file.

🌐
Devinschumacher
devinschumacher.com › how-to-setup-jupyter-notebook-virtual-environment-vs-code-kernels
How To Setup Jupyter Notebook in VS Code (w/ Virtual Env & Kernels) | Devin Schumacher
September 20, 2022 - Open the VSCODE search bar: cmd+shift+p · Type in & choose: "Create: New Jupyter Notebook" Open the VSCODE search bar: cmd+shift+p · Type in & choose: "Notebook: Select Notebook Kernel" At the bottom of your VS Code window, you should see "Jupyter Server: Local" Click that, and a dropdown ...
🌐
Visual Studio Code
code.visualstudio.com › docs › datascience › jupyter-notebooks
Jupyter Notebooks in VS Code
November 3, 2021 - You can create a Jupyter Notebook ... or by creating a new .ipynb file in your workspace. Next, select a kernel using the kernel picker in the top right....
Top answer
1 of 11
16

Had to update the Jupyter extension, even though I had auto-update on.

2 of 11
8

I had a lot of problems myself in getting the updated list of jupyter kernel servers in old versions of Visual Studio code.

However, in the newer version of Visual Studio code (I am using version 1.76.2 on my ubuntu 18.04 machine; I hope this works also on Mac OS), you don't need to specify the jupyter kernel anymore: it is now enough to specify the python environment. This new feature and its use are described in this howto from visualstudio.

In short, once I installed the correct version of Visual Studio code, I performed the following steps:

  • I first make a virtual environment and install ipykernel in it:
virtualenv --python=python3 venv
. venv/bin.activate
pip3 install ipykernel
  • In Visual Studio code, while having opened a python file, I select using ctrl+shift+P (Shift+Command+P in Mac OS) the python interpreter (Python:Select Interpreter) and choose the one of the virtual environment that I have just created: /path/to/venv/bin/python. In my case, this step was necessary: indeed, I first had to choose the desired python interpreter on any python file before proceeding to the following step
  • In Visual Studio code still, while having opened a notebook file (.pynb file), I click on select kernel on the top right of the IDE, then click on "Python Environments": the environment I selected before for the python file (/path/to/venv/bin) will appear here, without having to add environments to the kernel lists. Once this environment is selected, the notebook should work as expected,

I hope it helps.

🌐
GitHub
github.com › microsoft › vscode-jupyter › issues › 9703
Kernel picker doesn't find venv installed ipykernels when setting 'defaultInterpreterPath' · Issue #9703 · microsoft/vscode-jupyter
April 18, 2022 - Installed kernels under venv don't show up in kernel pick list even after selecting venv as the main python interpreter. jupyter kernelspec list Available kernels: python3 /Users/username/workspace/repo/.vscode/src_python_twitter_ml_tfx__tfx/venv/share/jupyter/kernels/python3 src_python_twitter_ml_tfx__tfx /Users/gcasassaez/workspace/repo/.vscode/src_python_twitter_ml_tfx__tfx/venv/share/jupyter/kernels/src_python_twitter_ml_tfx__tfx
Author   casassg
🌐
GitHub
github.com › microsoft › vscode-jupyter › issues › 4147
cannot switch kernel in vscode ipynb interface · Issue #4147 · microsoft/vscode-jupyter
December 4, 2020 - Type of virtual environment used ... jupyter v2020.11.399280825 ... Using the kernel selector in the top right of the notebook interface changes the kernel used by the notebook...
Author   lindacmsheard