Skip to content

[Bug] Build from source on Python 3.15 fails on Windows with MSVC 14.52 (VS 2026) #1148

Backlog

Description

@matulni

Building stim from source on Python 3.15 fails on GitHub's windows-latest runner, which now ships Visual Studio 2026 with MSVC 14.52. This affects both the latest release (1.16.0) and the current dev version (1.17.dev). The same builds succeed on windows-2022 (MSVC 14.44), and the prebuilt 1.17.dev wheel installs fine on both runners.

Environment

  • stim 1.16.0
  • stim 1.17 dev
  • Python 3.15
  • GitHub Actions windows-latest: Visual Studio 2026 18.12, MSVC 14.52
  • GitHub Actions windows-2022: Visual Studio 2022 17.14, MSVC 14.44

Reproduction

On a windows-latest and windows-2022 GitHub Actions runners:

uv venv --python 3.15

uv pip install -v --no-binary stim "stim==1.16.0" # Fails on windows-latest, passes on windows-2022
uv pip install -v --prerelease=allow --no-binary stim "stim>=1.17.dev0,<1.18" # Fails on windows-latest, passes on windows-2022
uv pip install -v --prerelease=allow --only-binary stim "stim>=1.17.dev0,<1.18" # Passes on windows-latest, passes on windows-2022

Full .yml file

name: stim MSVC repro

on:
  workflow_dispatch:
  push:
    paths: [".github/workflows/stim-msvc-repro.yml"]

jobs:
  build-stim:
    strategy:
      fail-fast: false
      matrix:
        os: ["windows-latest", "windows-2022"]
        variant:
          - name: "1.16.0 / source"
            args: '--no-binary stim "stim==1.16.0"'
          - name: "1.17 dev / source"
            args: '--prerelease=allow --no-binary stim "stim>=1.17.dev0,<1.18"'
          - name: "1.17 dev / wheel"
            args: '--prerelease=allow --only-binary stim "stim>=1.17.dev0,<1.18"'
    name: "${{ matrix.variant.name }} / ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}
    defaults:
      run:
        shell: bash
    steps:
      - name: Show Visual Studio / MSVC versions
        run: |
          VSWHERE="/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe"
          "$VSWHERE" -latest -property displayName
          "$VSWHERE" -latest -property catalog_productDisplayVersion
          ls "$("$VSWHERE" -latest -property installationPath)/VC/Tools/MSVC"

      - name: Install uv and Python 3.15
        run: |
          pip install uv
          uv python install 3.15
          uv venv --python 3.15

      - name: Install stim (${{ matrix.variant.name }})
        run: uv pip install -v ${{ matrix.variant.args }}

      - name: Check import
        run: .venv/Scripts/python.exe -c "import stim; print(stim.__version__, stim.__file__)"

Error

error: Failed to build `stim==1.16.0`
  cause: The build backend returned an error
  cause: Call to `setuptools.build_meta.build_wheel` failed (exit code: 1)

         [stdout]
         running bdist_wheel
         running build
         running build_py
         creating python_build_stim\lib.win-amd64-cpython-315\stim
         copying glue\python\src\stim\_main_argv.py -> python_build_stim\lib.win-amd64-cpython-315\stim
         copying glue\python\src\stim\__init__.py -> python_build_stim\lib.win-amd64-cpython-315\stim
         running egg_info
         writing stim.egg-info\PKG-INFO
         writing dependency_links to stim.egg-info\dependency_links.txt
         writing entry points to stim.egg-info\entry_points.txt
         writing requirements to stim.egg-info\requires.txt
         writing top-level names to stim.egg-info\top_level.txt
         reading manifest file 'stim.egg-info\SOURCES.txt'
         reading manifest template 'MANIFEST.in'
         adding license file 'LICENSE'
         writing manifest file 'stim.egg-info\SOURCES.txt'
         copying glue\python\src\stim\__init__.pyi -> python_build_stim\lib.win-amd64-cpython-315\stim
         running build_ext
         building 'stim._detect_machine_architecture' extension
         "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.52.37025\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include -Isrc -IC:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\include -IC:\Users\runneradmin\AppData\Roaming\uv\python\cpython-3.15-windows-x86_64-none\include -IC:\Users\runneradmin\AppData\Roaming\uv\python\cpython-3.15-windows-x86_64-none\Include "-IC:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.52.37025\include" "-IC:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.52.37025\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8.1\include\um" /EHsc /Tpsrc\stim\py\march.pybind.cc /Fopython_build_stim\temp.win-amd64-cpython-315\Release\src\stim\py\march.pybind.obj /std:c++20 /O2 /DVERSION_INFO=1.16.0
         march.pybind.cc
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\detail/type_caster_base.h(493): warning C4996: '_PyThreadState_UncheckedGet': deprecated in 3.14
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\cast.h(51): error C2440: 'return': cannot convert from 'StringType' to '_Ty &&'
                 with
                 [
                     StringType=std::basic_string<char,std::char_traits<char>,std::allocator<char>>
                 ]
                 and
                 [
                     _Ty=std::string
                 ]
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\cast.h(51): note: You cannot bind an lvalue to an rvalue reference
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\cast.h(51): note: the template instantiation context (the oldest one first) is
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\detail\../pytypes.h(649): note: see reference to function template instantiation or specialization 'T pybind11::handle::cast<std::string>(void) const' being compiled
                 with
                 [
                     T=std::string
                 ]
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\cast.h(1111): note: see reference to function template instantiation or specialization 'T pybind11::cast<std::string,0>(const pybind11::handle &)' being compiled
                 with
                 [
                     T=std::string
                 ]
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpxkMewL\Lib\site-packages\pybind11\include\pybind11\cast.h(1053): note: see reference to function template instantiation or specialization '_Ty &&pybind11::detail::cast_op<std::string>(pybind11::detail::type_caster<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,void> &&)' being compiled
                 with
                 [
                     _Ty=std::string
                 ]

         [stderr]
         error: Command ['C:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Tools\\MSVC\\14.52.37025\\bin\\HostX86\\x64\\cl.exe', '/c', '/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD', '-IC:\\Users\\runneradmin\\AppData\\Local\\uv\\cache\\builds-v0\\.tmpxkMewL\\Lib\\site-packages\\pybind11\\include', '-Isrc', '-IC:\\Users\\runneradmin\\AppData\\Local\\uv\\cache\\builds-v0\\.tmpxkMewL\\include', '-IC:\\Users\\runneradmin\\AppData\\Roaming\\uv\\python\\cpython-3.15-windows-x86_64-none\\include', '-IC:\\Users\\runneradmin\\AppData\\Roaming\\uv\\python\\cpython-3.15-windows-x86_64-none\\Include', '-IC:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Tools\\MSVC\\14.52.37025\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Tools\\MSVC\\14.52.37025\\ATLMFC\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Auxiliary\\VS\\include', '-IC:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.26100.0\\ucrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\um', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\shared', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\winrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\cppwinrt', '-IC:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8.1\\include\\um', '/EHsc', '/Tpsrc\\stim\\py\\march.pybind.cc', '/Fopython_build_stim\\temp.win-amd64-cpython-315\\Release\\src\\stim\\py\\march.pybind.obj', '/std:c++20', '/O2', '/DVERSION_INFO=1.16.0'] returned non-zero exit status 2.

hint: Build failures usually indicate a problem with the package or the build environment
error: Failed to build `stim==1.17.dev1793242987`
  cause: The build backend returned an error
  cause: Call to `setuptools.build_meta.build_wheel` failed (exit code: 1)

         [stdout]
         running bdist_wheel
         running build
         running build_py
         creating python_build_stim\lib.win-amd64-cpython-315\stim
         copying glue\python\src\stim\_main_argv.py -> python_build_stim\lib.win-amd64-cpython-315\stim
         copying glue\python\src\stim\__init__.py -> python_build_stim\lib.win-amd64-cpython-315\stim
         running egg_info
         writing stim.egg-info\PKG-INFO
         writing dependency_links to stim.egg-info\dependency_links.txt
         writing entry points to stim.egg-info\entry_points.txt
         writing requirements to stim.egg-info\requires.txt
         writing top-level names to stim.egg-info\top_level.txt
         reading manifest file 'stim.egg-info\SOURCES.txt'
         reading manifest template 'MANIFEST.in'
         adding license file 'LICENSE'
         writing manifest file 'stim.egg-info\SOURCES.txt'
         copying glue\python\src\stim\__init__.pyi -> python_build_stim\lib.win-amd64-cpython-315\stim
         running build_ext
         building 'stim._detect_machine_architecture' extension
         "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.52.37025\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include -Isrc -IC:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\include -IC:\Users\runneradmin\AppData\Roaming\uv\python\cpython-3.15-windows-x86_64-none\include -IC:\Users\runneradmin\AppData\Roaming\uv\python\cpython-3.15-windows-x86_64-none\Include "-IC:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.52.37025\include" "-IC:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.52.37025\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8.1\include\um" /EHsc /Tpsrc\stim\py\march.pybind.cc /Fopython_build_stim\temp.win-amd64-cpython-315\Release\src\stim\py\march.pybind.obj /std:c++20 /Od /DVERSION_INFO=1.17.dev1793242987
         march.pybind.cc
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\detail/type_caster_base.h(493): warning C4996: '_PyThreadState_UncheckedGet': deprecated in 3.14
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\cast.h(51): error C2440: 'return': cannot convert from 'StringType' to '_Ty &&'
                 with
                 [
                     StringType=std::basic_string<char,std::char_traits<char>,std::allocator<char>>
                 ]
                 and
                 [
                     _Ty=std::string
                 ]
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\cast.h(51): note: You cannot bind an lvalue to an rvalue reference
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\cast.h(51): note: the template instantiation context (the oldest one first) is
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\detail\../pytypes.h(649): note: see reference to function template instantiation or specialization 'T pybind11::handle::cast<std::string>(void) const' being compiled
                 with
                 [
                     T=std::string
                 ]
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\cast.h(1111): note: see reference to function template instantiation or specialization 'T pybind11::cast<std::string,0>(const pybind11::handle &)' being compiled
                 with
                 [
                     T=std::string
                 ]
         C:\Users\runneradmin\AppData\Local\uv\cache\builds-v0\.tmpFxJUSV\Lib\site-packages\pybind11\include\pybind11\cast.h(1053): note: see reference to function template instantiation or specialization '_Ty &&pybind11::detail::cast_op<std::string>(pybind11::detail::type_caster<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,void> &&)' being compiled
                 with
                 [
                     _Ty=std::string
                 ]

         [stderr]
         cl : Command line warning D9025 : overriding '/O2' with '/Od'
         error: Command ['C:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Tools\\MSVC\\14.52.37025\\bin\\HostX86\\x64\\cl.exe', '/c', '/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD', '-IC:\\Users\\runneradmin\\AppData\\Local\\uv\\cache\\builds-v0\\.tmpFxJUSV\\Lib\\site-packages\\pybind11\\include', '-Isrc', '-IC:\\Users\\runneradmin\\AppData\\Local\\uv\\cache\\builds-v0\\.tmpFxJUSV\\include', '-IC:\\Users\\runneradmin\\AppData\\Roaming\\uv\\python\\cpython-3.15-windows-x86_64-none\\include', '-IC:\\Users\\runneradmin\\AppData\\Roaming\\uv\\python\\cpython-3.15-windows-x86_64-none\\Include', '-IC:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Tools\\MSVC\\14.52.37025\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Tools\\MSVC\\14.52.37025\\ATLMFC\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\VC\\Auxiliary\\VS\\include', '-IC:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.26100.0\\ucrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\um', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\shared', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\winrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\cppwinrt', '-IC:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8.1\\include\\um', '/EHsc', '/Tpsrc\\stim\\py\\march.pybind.cc', '/Fopython_build_stim\\temp.win-amd64-cpython-315\\Release\\src\\stim\\py\\march.pybind.obj', '/std:c++20', '/Od', '/DVERSION_INFO=1.17.dev1793242987'] returned non-zero exit status 2.

hint: Build failures usually indicate a problem with the package or the build environment

Context

Error encountered in the CI of graphix#655.
stim 1.16 works on Linux and macOS (gcc/clang) runners with Python 3.15

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions