Imports not being found in notebook after changing the kernel
Follow the directions here:
- https://github.com/bokeh/tutorial
Open the first notebook
Select a kernel that comes from the bk-tutorial environment
Pylance doesn't find the first import:
If you reload VS code it will work.
Output log looks like the notebook change event didn't prompt a request for new settings:
2023-11-29 13:25:15.704 [info] (14140) [BG(2)] getSemanticTokens full at C:\Users\rchiodo\source\tutorial\notebooks\01_introduction.ipynb#W3sZmlsZQ==.py (3ms)
2023-11-29 13:25:23.233 [info] (Client) Jupyter provided interpreter path override: c:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe
That was the only thing that ended up in the log after changing the kernel.
To reproduce after reloading:
- pick a kernel that doesn't have bokeh installed
- save the notebook
- reopen VS code
- show that the import is not resolved
- change the kernel to the bk-tutorial kernel again
- the import will still not be resolved (even though the right kernel is picked)
need to repro on stable to see if this is a regression
This is not a regression, but it can be hard to reproduce.
You might have to reclone the bokeh tutorial to get it to reproduce. I can only reproduce it on never opened files.
Okay I wasn't crazy, this seems to be caused by VS code not sending a kernel change notification: https://github.com/microsoft/vscode-jupyter/issues/15965
I can only repro it with that bokeh tutorial though.
@rchiodo, it looks like the upstream issue has been closed. Can this issue be closed as well?
Yeah I think this is fixed now with our latest release and the Jupyter extension's latest release.