Skip to content

Pyrefly VS Code extension ignores the interpreter selected in “Python: Select Interpreter” #1632

Description

@c0rychu

Describe the Bug

Even if I selected the Python interpreter in VS Code via > Python: Select Interpreter, the Pyrefly extension does not respect that. For instance, in an open .py file, it complains about Could not find import ... like

Could not find import of `rich.console`
  Looked in these locations (from config in `/Users/username/XXXXX/pyproject.toml`):
  Search path (from config file): ["/Users/username/XXXXX/src"]
  Import root (inferred from project layout): "/Users/username/XXXXX/src"
  Site package path queried from interpreter: ["/Users/username/.pyenv/versions/3.12.12/lib/python3.12", "/Users/username/.pyenv/versions/3.12.12/lib/python3.12/lib-dynload", "/Users/username/.pyenv/versions/3.12.12/lib/python3.12/site-packages"]
Pyrefly(missing-import)

Only if I set

[tool.pyrefly]
python-interpreter-path = ".venv/bin/python"

in my pyproject.toml, the Pyrefly extension can then find the correct interpreter.

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

VS Code:

Version: 1.106.2 (Universal)
Commit: 1e3c50d64110be466c0b4a45222e81d2c9352888
Date: 2025-11-19T16:56:50.023Z
Electron: 37.7.0
ElectronBuildId: 12781156
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

Pyrefly Extension:

Identifier
meta.pyrefly
Version
0.42.2

Metadata

Metadata

Assignees

Labels

language-serverIssues specific to our IDE integration rather than type checking

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions