Skip to content

Diagnostic for importing a module present in typeshed/stubs which is not installed should be reportMissingImports rather than reportMissingModuleSource #8042

@jonathandung

Description

@jonathandung

Type: Bug

Even when a third-party library such as tensorflow is not installed in my virtual environment, and has never been, Pylance only produces a reportMissingModuleSource warning, when it should be a reportMissingImports error. This is frustrating, to say the least. This possibly stems from Pylance being able to find the annotations in its own distribution of typeshed. I believe that reportMissingModuleSource should only be raised when there is a stub outside of typeshed but the source is not present. In comparison, using symbols from a module such as nltk that is not in typeshed correctly raises reportMissingImports. Even if the developer knows the required modules are always present and wants to patch the error, they would not go about inserting the stub in the Pylance typeshed-fallback folder or similar.

Extension version: 2026.2.101
VS Code version: Code 1.119.0 (8b640eef5a6c6089c029249d48efa5c99adf7d51, 2026-05-05T11:23:50-07:00)
OS version: Windows_NT x64 10.0.26200
Modes:

System Added Logs
2026-05-10 14:35:17.128 [info] Client: Pylance client (2026.2.101) started with python extension (2026.5.2026050801)
2026-05-10 14:35:18.520 [info] (560): Server root directory: file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist
2026-05-10 14:35:18.597 [info] (560): Pylance language server 2026.2.101 (pyright version 1.1.409, commit 34c556b7) starting
2026-05-10 14:35:18.622 [info] (560): Starting service instance "asyncutils" for workspace "c:\Users\Jonathan Dung\asyncutils"
2026-05-10 14:35:19.686 [info] (560): Loading background bundle file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist/copilot-background.bundle.js into file:///c%3A/Users/Jonathan%20Dung/asyncutils...
2026-05-10 14:35:19.730 [info] (560): Starting Mcp server id:63025 ...
2026-05-10 14:35:19.811 [info] (560): FG(asyncutils): Loading pyproject.toml file at c:\Users\Jonathan Dung\asyncutils\pyproject.toml
2026-05-10 14:35:19.816 [info] (560): FG(asyncutils): Setting environmentName for service "asyncutils": "3.14.0 (global)"
2026-05-10 14:35:19.816 [info] (560): FG(asyncutils): Setting pythonPath for service "asyncutils": "C:\Program Files\Python314\python.exe"
2026-05-10 14:35:19.817 [info] (560): FG(asyncutils): No include entries specified; assuming c:\Users\Jonathan Dung\asyncutils
2026-05-10 14:35:19.818 [info] (560): FG(asyncutils): Auto-excluding **/node_modules
2026-05-10 14:35:19.818 [info] (560): FG(asyncutils): Auto-excluding **/__pycache__
2026-05-10 14:35:19.818 [info] (560): FG(asyncutils): Auto-excluding **/.*
2026-05-10 14:35:19.895 [info] (560): FG(asyncutils): Assuming Python version 3.14.0.final.0
2026-05-10 14:35:20.049 [info] (560): [Editable Installs] Starting dynamic pth file resolution for Python: C:\Program Files\Python314\python.exe
2026-05-10 14:35:20.063 [info] (560): [Editable Installs] No sandbox available for Python C:\Program Files\Python314\python.exe. Dynamic pth file resolution requires Python 3.13 or later.
2026-05-10 14:35:20.085 [info] (560): FG(asyncutils): Found 124 source files
2026-05-10 14:35:20.548 [info] (560): PQ(asyncutils): Priority queue background worker(2) root directory: file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist
2026-05-10 14:35:20.549 [info] (560): PQ(asyncutils): Priority queue background worker(2) started
2026-05-10 14:35:20.549 [info] (560): Settings have not changed. Skipping update.
2026-05-10 14:35:27.748 [info] Client: Pylance client (2026.2.101) started with python extension (2026.5.2026050801)
2026-05-10 14:35:28.235 [info] (2812): Server root directory: file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist
2026-05-10 14:35:28.237 [info] (2812): Pylance language server 2026.2.101 (pyright version 1.1.409, commit 34c556b7) starting
2026-05-10 14:35:28.247 [info] (2812): Starting service instance "python stuff" for workspace "c:\Users\Jonathan Dung\python stuff"
2026-05-10 14:35:29.126 [info] (2812): Loading background bundle file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist/copilot-background.bundle.js into file:///c%3A/Users/Jonathan%20Dung/python%20stuff...
2026-05-10 14:35:29.172 [info] (2812): Starting Mcp server id:59555 ...
2026-05-10 14:35:29.385 [info] (2812): FG(python stuff): Setting environmentName for service "python stuff": "3.14.0 (global)"
2026-05-10 14:35:29.385 [info] (2812): FG(python stuff): Setting pythonPath for service "python stuff": "C:\Program Files\Python314\python.exe"
2026-05-10 14:35:29.386 [info] (2812): FG(python stuff): No include entries specified; assuming c:\Users\Jonathan Dung\python stuff
2026-05-10 14:35:29.387 [info] (2812): FG(python stuff): Auto-excluding **/node_modules
2026-05-10 14:35:29.388 [info] (2812): FG(python stuff): Auto-excluding **/__pycache__
2026-05-10 14:35:29.388 [info] (2812): FG(python stuff): Auto-excluding **/.*
2026-05-10 14:35:29.473 [info] (2812): FG(python stuff): Assuming Python version 3.14.0.final.0
2026-05-10 14:35:29.635 [info] (2812): [Editable Installs] Starting dynamic pth file resolution for Python: C:\Program Files\Python314\python.exe
2026-05-10 14:35:29.646 [info] (2812): [Editable Installs] No sandbox available for Python C:\Program Files\Python314\python.exe. Dynamic pth file resolution requires Python 3.13 or later.
2026-05-10 14:35:29.681 [info] (2812): FG(python stuff): Found 8 source files
2026-05-10 14:35:29.865 [info] (2812): PQ(python stuff): Priority queue background worker(2) root directory: file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist
2026-05-10 14:35:29.866 [info] (2812): PQ(python stuff): Priority queue background worker(2) started
2026-05-10 14:35:29.866 [info] (2812): Settings have not changed. Skipping update.
2026-05-10 14:35:30.514 [info] (2812): FG(python stuff): IDX(python stuff): Indexer background runner(3) root directory: file:///c%3A/Users/Jonathan%20Dung/.vscode/extensions/ms-python.vscode-pylance-2026.2.101/dist (index)
2026-05-10 14:35:30.514 [info] (2812): FG(python stuff): IDX(python stuff): Indexing(3) started
2026-05-10 14:35:31.500 [info] (2812): FG(python stuff): IDX(python stuff): scanned(3) 242 files over 1 exec env
2026-05-10 14:35:33.657 [warning] (2812): FG(python stuff): [ExternalProgram] _refreshSourceFileImports called for file with no parse results: file:///c%3A/Users/Jonathan%20Dung/python%20stuff/shit.py
2026-05-10 14:35:33.659 [warning] (2812): BG(python stuff): [ExternalProgram] _refreshSourceFileImports called for file with no parse results: file:///c%3A/Users/Jonathan%20Dung/python%20stuff/shit.py
2026-05-10 14:35:33.980 [info] (2812): FG(python stuff): Found 7 source files
2026-05-10 14:35:34.847 [info] (2812): FG(python stuff): IDX(python stuff): Long operation: index execution environment file:///c%3A/Users/Jonathan%20Dung/python%20stuff (3002ms)
2026-05-10 14:35:34.950 [info] (2812): FG(python stuff): IDX(python stuff): Long operation: index packages file:///c%3A/Users/Jonathan%20Dung/python%20stuff (3132ms)
2026-05-10 14:35:34.950 [info] (2812): FG(python stuff): IDX(python stuff): indexed(3) 242 files over 1 exec env
2026-05-10 14:35:35.065 [info] (2812): FG(python stuff): IDX(python stuff): Indexing finished(3).
2026-05-10 14:40:28.121 [info] (2812): FG(python stuff): Found 8 source files
2026-05-10 14:48:58.380 [warning] (2812): FG(python stuff): [ExternalProgram] _refreshSourceFileImports called for file with no parse results: file:///c%3A/Users/Jonathan%20Dung/python%20stuff/builtins.pyi
2026-05-10 14:48:58.381 [warning] (2812): BG(python stuff): [ExternalProgram] _refreshSourceFileImports called for file with no parse results: file:///c%3A/Users/Jonathan%20Dung/python%20stuff/builtins.pyi

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 x 2419)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x9a49 [Intel(R) Iris(R) Xe Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.6737 ACTIVE
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8328
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 7.85GB (1.12GB free)
Process Argv --crash-reporter-id 9453c078-702b-4b0c-be82-802577994672
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsdeactivate2:31505458
cloudbuttont:31379625
42190218_ostrepl:31403339
ec5jj548:31422691
cp_cls_t_966_ss:31454198
inlinechat_v2_hd992725:31505030
4je02754:31466945
8hhj4413:31478653
38bie571_auto:31429954
cp_cls_t_1081:31454832
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_treatment2:31471001
46204921:31447328
th_e6b84190:31511298
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
89g7j272:31507493
7e187181:31503455
i2gc6536:31499202
ghj88844:31499326
ec1eg703:31491645
ddid_c:31478207
getcmakediagnosticson:31489824
ja75b849:31510500
7df3h592:31509626
pro_large_t:31499376
cp_cls_c_1082:31504161
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_c_632:31510883
748c7209:31497895
cg448276_tst_on:31511779
b1g4i769:31505233
ha629193:31508444
539gd155_c:31506875

Metadata

Metadata

Assignees

Labels

ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.team needs to reproduceIssue has not been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions