microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 770 forks source link

Imports not being found in notebook after changing the kernel #5172

Open rchiodo opened 9 months ago

rchiodo commented 9 months ago

Follow the directions here:

Open the first notebook Select a kernel that comes from the bk-tutorial environment

Pylance doesn't find the first import:

image

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:

judej commented 9 months ago

need to repro on stable to see if this is a regression

rchiodo commented 9 months ago

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.

rchiodo commented 9 months ago

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

rchiodo commented 9 months ago

I can only repro it with that bokeh tutorial though.