Skip to content

Pylance not starting in specific projects #24852

Open
@bruecksen

Description

@bruecksen

Pylance is not starting in certain projects. In these projects, the Pylance server does not start at all (see attached logs). As a result:

  • All pylance features are not working.
  • The Python Language Server option is missing from the Output panel.
  • Pylance-specific commands (e.g., Pylance: Start Logging) fail with command not found.

I have tried several troubleshooting steps, including:

  • Selecting the correct Python interpreter.
  • Creating new virtual environments.
  • Using a virtual environment from a working project.
  • Setting up a new project from scratch.
  • Using django-cookiecutter as a template.
  • Despite these efforts, Pylance still does not start.

I have several older projects where Pylance works as expected, indicating that the issue is project-specific rather than system-wide.

Environment data

  • Pylance version: 2025.2.101
  • Vscode Version: 1.97.2 (Universal)
  • OS and version: Osx 14.5
  • Python version (& distribution if applicable, e.g. Anaconda): Python3.13

Repro Steps

  1. Create a clean project.
  2. Create a virtual environment.
  3. Select the virtual environment as the Python interpreter.
  4. Install Django as a dependency.
  5. Create a test.py file and import django.models.
  6. Try using Go to Definition on the import.

Logs

Python Output (Pylance not working)
2025-02-27 19:53:11.011 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-02-27 19:53:11.011 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-02-27 19:53:11.011 [info] Experiment 'pythonTestAdapter' is active
2025-02-27 19:53:11.011 [info] Native locator: Refresh started
2025-02-27 19:53:11.011 [info] Native locator: Refresh started
2025-02-27 19:53:11.061 [info] Python interpreter path: ~/.virtualenvs/unbound-trajectories-wagtail-hQSuZdI_-py3.13/bin/python
Python Output (Pylance working)
2025-02-27 19:53:11.457 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-02-27 19:53:11.457 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-02-27 19:53:11.457 [info] Experiment 'pythonTestAdapter' is active
2025-02-27 19:53:11.457 [info] Native locator: Refresh started
2025-02-27 19:53:11.465 [info] > pyenv which python
2025-02-27 19:53:11.466 [info] cwd: .
2025-02-27 19:53:12.984 [info] Python interpreter path: ~/.virtualenvs/lifelessons/bin/python
2025-02-27 19:53:13.285 [info] > . ~/.virtualenvs/lifelessons/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.1.2025022501-darwin-arm64/python_files/printEnvVariables.py
2025-02-27 19:53:13.286 [info] shell: bash
2025-02-27 19:53:13.328 [info] > ~/.pyenv/versions/mcempirics/bin/python ~/.vscode/extensions/ms-python.python-2025.1.2025022501-darwin-arm64/python_files/printEnvVariables.py
2025-02-27 19:53:13.328 [info] shell: bash
...
2025-02-27 19:53:14.182 [info] Starting Pylance language server.
...

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions