Issue
For a couple of months I've had issues with working with virtual envs, python notebooks & jupyter in VSCode, for some reason, a lot of the time, it cannot find kernels I added, even though I can see them when running jupyter kernelspec list
. It seems random whether they appear or not. Reloading the screen and restarting vscode does not help, neither does disabling and re-enabling the python and jupyter extensions. I tried both from the button, select kernel and through the command palette. I usually start vscode from the command line, with my virtual environment activated. Moreover, a lot of kernels which I've deleted a long time ago still show up in the list.
Vscode and laptop are both up to date.
I've had issues with the integrated jupyter notebooks before, at first formatting and autocomplete didn't work in the notebook (but they did in regular python files).
I'm on MacOS, if that matters.
Solution
Sorry to tell that this is a bug, see bug report: Can't see or select Jupyter kernel's from Kernel drop-down
And now there's a workaround that:
- Find where python is installed
- Select the command Python: Select Interpreter
- Next select Enter interpreter path
- Next enter the path into the input box and hit Enter
This interpretr will now work in VS Code and you might need to re-load VS Code just once more to get it working in jupyter extension.
Please have a try.
Answered By - Molly Wang-MSFT Answer Checked By - Pedro (WPSolving Volunteer)