Skip to content

Use a persistent scikit-build build-dir to fix Windows tempdir cleanup flake#20

Merged
Transurgeon merged 1 commit into
mainfrom
fix/windows-build-tempdir
Jul 13, 2026
Merged

Use a persistent scikit-build build-dir to fix Windows tempdir cleanup flake#20
Transurgeon merged 1 commit into
mainfrom
fix/windows-build-tempdir

Conversation

@Transurgeon

Copy link
Copy Markdown
Member

Problem

build_wheels (windows-2022, *) jobs fail intermittently (e.g. runs #100, #101) with:

PermissionError: [WinError 32] The process cannot access the file because it is
being used by another process: 'C:\Users\RUNNER~1\AppData\Local\Temp\tmpXXXX\build'
ERROR Backend subprocess exited when trying to invoke build_wheel

The traceback is raised from TemporaryDirectory cleanup at the very end of build_wheel -- the wheel compiles fine; only the cleanup of scikit-build-core's temp build dir fails, because a lingering process (mspdbsrv.exe / AV scanner) still holds a handle in Temp. The same commit passed on the v0.6.0 tag run, confirming this is a flake, not a code issue.

Fix

Set a persistent, gitignored build dir so scikit-build-core never creates (or cleans up) a temporary directory:

[tool.scikit-build]
build-dir = "build/{wheel_tag}"

No temp dir, no cleanup, no race -- regardless of who holds the handle. build/ is already in .gitignore, so it stays out of the sdist; each CI job builds a single wheel tag, so there are no collisions; and local development gains incremental rebuilds.

🤖 Generated with Claude Code

…p flake

python -m build intermittently fails on windows-2022 CI runners with
PermissionError [WinError 32] while cleaning up scikit-build-core's
TemporaryDirectory build dir (a lingering mspdbsrv.exe/AV handle holds
files in Temp). The wheel itself builds fine; only the cleanup fails.

Setting build-dir to a persistent, gitignored location skips the
temporary directory entirely, so there is no cleanup to race with.
Also gives incremental rebuilds locally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Transurgeon
Transurgeon merged commit 9db427c into main Jul 13, 2026
15 checks passed
@Transurgeon
Transurgeon deleted the fix/windows-build-tempdir branch July 13, 2026 19:02
Transurgeon added a commit that referenced this pull request Jul 13, 2026
…p flake (#20)

python -m build intermittently fails on windows-2022 CI runners with
PermissionError [WinError 32] while cleaning up scikit-build-core's
TemporaryDirectory build dir (a lingering mspdbsrv.exe/AV handle holds
files in Temp). The wheel itself builds fine; only the cleanup fails.

Setting build-dir to a persistent, gitignored location skips the
temporary directory entirely, so there is no cleanup to race with.
Also gives incremental rebuilds locally.

Co-authored-by: Transurgeon <peter.zijie@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant