`missing-import` pyrefly can't find modules while pylance can in VS Code
Describe the Bug
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
Pyrefly Version: 64.0
Python 3.13.4 from uv sync command
Thanks for the report @luzede! To help us reproduce this, could you share:
- Which modules are flagged as missing? (stdlib, third-party from uv sync, or local modules in your project?)
- Your project structure : If this is a single Python package, a workspace, or a monorepo?
- Your pyproject.toml (and pyrefly.toml if you have one)
- Whether pyrefly is detecting your uv-managed virtual environment,you can check by running pyrefly check --output-format=full
from the project root and looking at the resolved python_interpreter / site_package_path in the output. - Your Pylance configuration for comparison. Specifically python.defaultInterpreterPath if set.
One common case: pyrefly may not be auto-detecting the .venv/ that uv sync creates. If you point pyrefly at the interpreter explicitly (via python_interpreter in pyrefly.toml or the VS Code setting), do the missing-import errors go away?
cc @kinto0 — this looks like an LSP/interpreter-discovery issue.
All the python related custom user settings of my VSCode
{
"python.defaultInterpreterPath": "",
"python.languageServer": "Pylance",
"editor.inlayHints.enabled": "offUnlessPressed",
"python.pyrefly.disableLanguageServices": true,
"python.terminal.useEnvFile": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
"python.terminal.activateEnvInCurrentTerminal": true,
"ruff.importStrategy": "useBundled"
}
I use Pyrefly through extension, I didn't install the Pyrefly tool to be able to run the cmd commands.
All the third party libraries from uv sync are not being found
I tried via "python_interpreter", restarted the extension host and was still getting the same issue.
# ./pyproject.toml
[project]
name = "simply-hub"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"alembic>=1.17.2",
"fastapi[standard]>=0.122.0",
"lxml>=6.0.2",
"pandas>=2.3.3",
"psycopg2-binary>=2.9.11",
"pydantic-settings>=2.12.0",
"python-multipart>=0.0.20",
"sqlalchemy>=2.0.44",
"uvicorn>=0.38.0",
"xlrd>=2.0.2",
]
After installing the tool using uv tool install pyrefly, the results are:
INFO Found `C:\Users\luzede\Documents\Work\simply-hub\pyproject.toml` marking project root, checking root directory with default configuration
INFO 0 errors
No `pyrefly.toml` found — using preset `basic`.
Run `pyrefly init` to continue setting up Pyrefly.
Docs: https://pyrefly.org/en/docs/installation/
I want to note that I had this exact same issue in the past too in some other repo. I disabled the extension altogether, after a few weeks I reinstalled and enabled it and seemed to work fine. Also I only have issue with this specific project. In another project it seems to work fine, they share the same vs code profile.
Version 0.64.1 seems to have solved this issue. Thank you <3
Version 0.64.1 seems to have solved this issue. Thank you <3
thanks for the detailed repro instructions!!
0.64.0 would have required you uninstall the python-environments extension (microsoft has done a staged rollout so some people have it). in 0.64.1 we support it natively! glad it works