Skip to content

Python language server never starts properly the first time the notebook is opened #16526

@guidocioni

Description

@guidocioni

Environment data

  • VS Code version: 1.98.2
  • Jupyter Extension version: v2025.2.0
  • Python Extension version : 2025.2.0
  • OS (Windows | Mac | Linux distro) and version: MacOS 13.7.4
  • Python and/or Anaconda version: 3.12.8
  • Type of virtual environment used: conda
  • Jupyter server running: Local

Behaviour

I'm quite puzzled as to why never reported this issue because I've been seeing it for months on different machines.
Basically EVERY time I open a Notebook for the first time, the Python Language Server is not initialized correctly and this basically makes the whole IntelliSense part useless. The Notebook functionality is not affected though.

See as example this video capture.

bug.mov

What I'm doing is

  • Opening a Notebook where a simple pandas import is done to show the package version.
  • Even though the default environment is activated (and this environment has pandas installed), IntelliSense shows a message Import pandas could not be resolved from source
  • Switching to base environment shows the same message, and this is expected because pandas is not installed there
  • Switching back to default correctly loads the language server, and the message disappears (as expected because pandas is installed in this env).

Notes:

  • Restarting the extensions host does solve the issue
  • Leaving the VsCode window open and re-opening the Notebook does not cause the issue to appear (probably because the Extensions has been already restarted)
  • Restarting the Python Language Server does not solve the issue

My guess is that there is something preventing the Extension to start properly the first time but I do not seem anything particular from the logs...
What could I look into to understand better where the issue is coming from?

Here are detailed logs of the python language server

Details
2025-04-02 10:10:31.106 [info] [Info  - 10:10:31 AM] (56418) Starting service instance "<default>"
2025-04-02 10:10:31.211 [info] [Info  - 10:10:31 AM] (56418) Setting environmentName for service "<default>": "3.12.8 (default conda)"
2025-04-02 10:10:31.211 [info] [Info  - 10:10:31 AM] (56418) Setting pythonPath for service "<default>": "/Users/guidocioni/miniforge3/envs/default/bin/python"
2025-04-02 10:10:31.212 [info] [Info  - 10:10:31 AM] (56418) No include entries specified; assuming /<default workspace root>
2025-04-02 10:10:31.212 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/node_modules
2025-04-02 10:10:31.212 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/__pycache__
2025-04-02 10:10:31.212 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/.*
2025-04-02 10:10:31.260 [info] [Info  - 10:10:31 AM] (56418) Assuming Python version 3.12.8.final.0
2025-04-02 10:10:31.332 [info] [Error - 10:10:31 AM] (56418) File or directory "/<default workspace root>" does not exist.
2025-04-02 10:10:31.333 [info] [Info  - 10:10:31 AM] (56418) No source files found.
2025-04-02 10:10:31.346 [info] [Info  - 10:10:31 AM] (56418) Starting service instance "<default>"
2025-04-02 10:10:31.350 [info] [Info  - 10:10:31 AM] (56418) Setting environmentName for service "<default>": "3.12.8 (default conda)"
2025-04-02 10:10:31.350 [info] [Info  - 10:10:31 AM] (56418) Setting pythonPath for service "<default>": "/Users/guidocioni/miniforge3/envs/default/bin/python"
2025-04-02 10:10:31.350 [info] [Info  - 10:10:31 AM] (56418) No include entries specified; assuming /<default workspace root>
2025-04-02 10:10:31.350 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/node_modules
2025-04-02 10:10:31.350 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/__pycache__
2025-04-02 10:10:31.350 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/.*
2025-04-02 10:10:31.375 [info] [Info  - 10:10:31 AM] (56418) Assuming Python version 3.12.8.final.0
2025-04-02 10:10:31.416 [info] [Error - 10:10:31 AM] (56418) File or directory "/<default workspace root>" does not exist.
2025-04-02 10:10:31.416 [info] [Info  - 10:10:31 AM] (56418) No source files found.
2025-04-02 10:10:31.431 [info] [Info  - 10:10:31 AM] (56418) Setting environmentName for service "<default>": "3.12.8 (default conda)"
2025-04-02 10:10:31.431 [info] [Info  - 10:10:31 AM] (56418) Setting pythonPath for service "<default>": "/Users/guidocioni/.vscode/extensions/ms-python.vscode-pylance-2025.3.2/dist"
2025-04-02 10:10:31.431 [info] [Info  - 10:10:31 AM] (56418) No include entries specified; assuming /<default workspace root>
2025-04-02 10:10:31.431 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/node_modules
2025-04-02 10:10:31.432 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/__pycache__
2025-04-02 10:10:31.432 [info] [Info  - 10:10:31 AM] (56418) Auto-excluding **/.*
2025-04-02 10:10:31.457 [info] [Error - 10:10:31 AM] (56418) File or directory "/<default workspace root>" does not exist.
2025-04-02 10:10:31.457 [info] [Info  - 10:10:31 AM] (56418) No source files found.
2025-04-02 10:10:31.755 [info] [Info  - 10:10:31 AM] (56418) Priority queue background worker(2) root directory: file:///Users/guidocioni/.vscode/extensions/ms-python.vscode-pylance-2025.3.2/dist
2025-04-02 10:10:31.755 [info] [Info  - 10:10:31 AM] (56418) Priority queue background worker(2) started
2025-04-02 10:10:31.887 [info] [Info  - 10:10:31 AM] (56418) Priority queue background worker(4) root directory: file:///Users/guidocioni/.vscode/extensions/ms-python.vscode-pylance-2025.3.2/dist
2025-04-02 10:10:31.887 [info] [Info  - 10:10:31 AM] (56418) Priority queue background worker(4) started

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugnotebook-intellisenseIntellisense & other language features in notebook cells for any language

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions