Jupyter notebook kernel changes not detected to Pylance
See original GitHub issueEnvironment data
- VS Code version: 1.57.1
- Jupyter Extension version (available under the Extensions sidebar): v2021.6.999406279
- Python Extension version (available under the Extensions sidebar): v2021.6.944021595
- OS (Windows | Mac | Linux distro) and version: Windows 19043
- Python and/or Anaconda version: 3.8.5
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
- Jupyter server running: Local
Expected behaviour
Upon changing the kernel in the top right Pylance should detect module changes and resolve imports
Actual behaviour
Pylance will only detect kernel changes if you change the interpreter via the command palette
Before changing via command palette
After changing
Imports resolve
Steps to reproduce:
- Create a venv and install any pip module foo
- Create a notebook and import foo
- The pylance import detection will not update via changing kernel
- Changing via
Python: Select Interpreter
in the command palette will update Pylance
Note: code execution will work as if the venv is selected, but highlighting doesn’t. Another note: I’m sure a lot of my lingo I’m using is incorrect, I’m just starting out 😃
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:23 (19 by maintainers)
Top Results From Across the Web
Pylance not working in VSCode Jupyter notebooks
In my case Pylance was ignoring imports and variables. Restarting the Jupyter kernel solved it.
Read more >Jupyter - Visual Studio Marketplace
A Visual Studio Code extension that provides basic notebook support for language kernels that are supported in Jupyter Notebooks today, ...
Read more >Jupyter in Visual Studio Code – April 2021 Release - Python
When reopening a newly created Notebook with a Julia kernel, the cells should be detected as Julia. (#5148); Support switching kernels in Native ......
Read more >Easier Jupyter Notebook Setup for Python in VS Code Tooling
Inlay Hints (source: Microsoft). While the new hints don't change any code, the team is working to provide the ability to add suggested ......
Read more >Jupyter Notebooks in VS Code Extension NEW in 2022
Jupyter Notebooks in VS Code Extension NEW in 2022 - Tutorial Introducing Kernels, Markdown, & Cells. 13K views 1 year ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Woo hoo…
In a remote situation, pylance isn’t on the remote machine so it doesn’t know anything about the remote environment. In that situation pylance only knows about system modules.