-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
This is a bug I cannot wrap my head around, Visual Studio Code does not let me choose a virtual environment outside my workspace when using notebooks. I should first mention that everything works perfectly on PyCharm notebook Professional Edition (but I prefer VSCode's way of using notebooks) so it's not a problem from my computer.
When I click on Select Kernel (top right of the notebook screen), I only see my two base Python environments. Both work. I would however like to use one of my virtual environment. So I used the >Python: Select Interpreter option because in the Select Kernel, it does not let me enter a custom path:
Here, it's easy for me to find the path/to/python.exe of my virtual environment (I'm on Python 3.12.5) by clicking on Enter interpreter path:
However, when I click and locate path/to/python.exe, nothing happens.
There is still, in the notebook, the Select Kernel button saying that I have not selected any Python environment for my notebook. And when I click on it, my virtual environment that I previously selected does not appear. Only my base Python versions appear.
Things I did:
- I restarted my computer.
- I uninstalled VSCode, and reinstalled VSCode.
- I looked for Windows Updates.
- I looked for VSCode Updates. None were found.
- I installed
ipykernelto my virtual environment but it was already installed. - I made sure I had the
Pythonextension enabled on VSCode. - I made sure I had the
jupyterextension enabled on VSCode. - I made sure the base environments worked as expected when choosing them in
Select Kernel. They did. - I made sure everything worked with my virtual environments in PyCharm Professional. They did.
- I used
python3 -m ipykernel install --user --name=projectnameafter activating my venv. - I tried to do
>Jupyter: create interactive Windowso that kernel will connect to the Python environment automatically and then try to see if clicking onSelect Kernelwould make the venv appear. It doesn't work. It appears in my interactive window, but not in my notebook. - I tried to clear the cache:

Does this issue occur when all extensions are disabled?:
No because I need the Jupyter extension and the Python extension. If I don't have those extensions enabled, another issue happens: I can't use notebooks at all but that's a normal issue.
Version: 1.98.0 (user setup)
Commit: 6609ac3d66f4eade5cf376d1cb76f13985724bcb
Date: 2025-03-04T21:06:18.612Z
Electron: 34.2.0
ElectronBuildId: 11044223
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Windows_NT x64 10.0.22631
Steps to Reproduce:
- Make a venv (do not use
conda) outside your workspace. - Try to use it in a notebook.


