Skip to content

Unable or resolve indirect imports #25470

@smac89

Description

@smac89

Type: Bug

Behaviour

Vscode is unable to resolve imports which are not directly imported by specifying the full path to the symbol

Steps to reproduce:

  1. Create a new folder and change directories to that folder
  2. use pdm to create a virtual environment (pdm init --no-git)
  3. Install a package like sqlalchemy (pdm add sqlalchemy)
  4. In that folder, create a main.py file, and attempt to import something from sqlalchemy
  5. Notice that while vscode will autosuggest the completion, it will mark the symbol as "unknown", thus hindering further type-inference
Video.Project.2.mp4

This has to be a bug, because it was working just fine a few days ago. As you can see from the video, the suggestions for imports includes select, but afterwards, everything else acts dumb and refuses to acknowledge the symbol.

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2025-09-18 11:41:41.609 [info] Telemetry level is off
2025-09-18 11:41:41.609 [info] Experiments are disabled, only manually opted experiments are active.
2025-09-18 11:41:41.609 [warning] Dir "/tmp/importpy/.pixi/envs" is not watchable (directory does not exist)
2025-09-18 11:41:41.819 [info] > conda info --json
2025-09-18 11:41:41.821 [info] Skipping ActivatedEnv Detection:  process.env.VSCODE_CLI !== '1'
2025-09-18 11:41:41.827 [info] Python interpreter path: ./.venv/bin/python
2025-09-18 11:41:42.031 [info] > pyenv which python
2025-09-18 11:41:42.031 [info] cwd: .
2025-09-18 11:41:43.325 [info] Starting Pylance language server.
2025-09-18 11:41:45.205 [info] Running installed packages checker:  {
  id: '/tmp/importpy/.venv/bin/python',
  sysPrefix: '/tmp/importpy/.venv',
  envType: 'Venv',
  envName: '.venv',
  envPath: '/tmp/importpy/.venv',
  path: '/tmp/importpy/.venv/bin/python',
  architecture: 3,
  sysVersion: '3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]',
  version: {
    raw: '3.13.7',
    major: 3,
    minor: 13,
    patch: 7,
    build: [],
    prerelease: [ 'final', '0' ]
  },
  displayName: "Python 3.13.7 ('.venv')",
  detailedDisplayName: "Python 3.13.7 ('.venv': venv)",
  type: 'Virtual'
} /home/chigozirim/.vscode-server/extensions/ms-python.python-2025.14.0-linux-x64/python_files/installed_check.py /tmp/importpy/pyproject.toml
2025-09-18 11:41:45.205 [info] > ./.venv/bin/python ~/.vscode-server/extensions/ms-python.python-2025.14.0-linux-x64/python_files/installed_check.py ./pyproject.toml
2025-09-18 11:43:33.042 [info] Discover tests for workspace name: importpy - uri: /tmp/importpy/main.py
2025-09-18 11:49:38.822 [info] Discover tests for workspace name: importpy - uri: /tmp/importpy/main.py
2025-09-18 11:49:48.337 [info] Send text to terminal: source /tmp/importpy/.venv/bin/activate

Extension version: 2025.14.0
VS Code version: Code 1.104.0 (f220831ea2d946c0dcb0f3eaa480eb435a2c1260, 2025-09-10T06:46:18.035Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.7
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Pylance
User Settings

Multiroot scenario, following user settings may not apply:

envFile: "<placeholder>"

languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
adb-files Ero 0.0.4
astro-vscode ast 2.15.4
autodocstring njp 0.6.1
black-formatter ms- 2025.2.0
clang-format xav 1.9.0
codeium Cod 1.48.2
cpptools ms- 1.27.6
debugpy ms- 2025.10.0
docker doc 0.17.0
doxdocgen csc 1.4.0
even-better-toml tam 0.21.2
firebase-json dam 1.3.0
go gol 0.50.0
hcl has 0.6.0
hexeditor ms- 1.11.1
isort ms- 2025.0.0
js-debug ms- 1.104.0
jupyter ms- 2025.8.0
jupyter-renderers ms- 1.3.0
just ske 2.0.0
lua sum 3.15.0
prettier-vscode esb 11.0.0
python ms- 2025.14.0
redis-for-vscode Red 1.4.0
ruff cha 2025.26.0
shell-format fox 7.2.8
sqlite-viewer qwt 0.10.6
sqltools mtx 0.28.5
todo-tree Gru 0.0.226
vscode-clangd llv 0.2.0
vscode-containers ms- 2.1.0
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-powertoys ms- 0.1.1
vscode-jupyter-slideshow ms- 0.1.6
vscode-lldb vad 1.11.5
vscode-pylance ms- 2025.8.1
vscode-tailwindcss bra 0.14.26
vscode-versionlens pfl 1.22.3
vscode-xml red 0.29.0
xmake-vscode tbo 2.4.1
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13700F (24 x 2112)
GPU Status 2d_canvas: enabled
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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.73GB (10.08GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote WSL: Arch
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs 13th Gen Intel(R) Core(TM) i7-13700F (24 x 0)
Memory (System) 15.48GB (10.57GB free)
VM 0%

Metadata

Metadata

Assignees

No one assigned

    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