Meson (vendored in numpy's sdist) can't detect `cl.exe` when the newest installed VS instance is "Visual Studio 18" (2026)
Symptom** — with the plugin pinned to a working version, pip install numpy builds numpy from source via its
vendored Meson (1.5.2), which fails even though a VS 2026 Build Tools instance (18.9.2) is installed
alongside VS 2022:
Activating VS 18.9.2
..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
Running `cl /?` gave "[Errno 2] No such file or directory: 'cl'"Root cause — Meson's mesonbuild/utils/vsenv.py (1.5.2) locates a VS instance via vswhere.exe -latest -prerelease -requiresAny -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -requires Microsoft.VisualStudio.Workload.WDExpress -products * -utf8 -format json — no version filter, so it always
picks the newest qualifying instance (VS 2026 here). cl.exe genuinely exists and runs fine directly at
...\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\bin\Hostx64\x64\cl.exe, so the VS install
itself is not broken. Meson's post-vswhere activation (running vcvarsall.bat via a generated temp .bat,
capturing the environment, reapplying it to its own process) fails to produce a PATH that makes cl.exe
resolvable for this VS major version/instance layout, despite reporting Activating VS 18.9.2 with no error.
Confirmed by reusing an already-created venv's graalpy.exe and running graalpy.exe -m pip wheel numpy --no-deps directly from inside an officially-opened "x64 Native Tools Command Prompt for VS 2022" (bypassing
the plugin's own launcher-creation step): Meson correctly detected cl.exe from the VS 2022 instance and ninja
began real compilation. So VS 2022 works correctly once it's the active toolchain; the defect is in how Meson
selects/activates whichever instance vswhere -latest returns when that's a VS 18 (2026) instance.
Fix — uninstall/avoid having a VS 2026 instance registered alongside older ones, so vswhere -latest
resolves to a VS version Meson 1.5.2 supports (e.g. VS 2022).
Source: oracle/graal