Closed
Description
In scipy/scipy#19855, I was experiencing Windows CI build failures with logs like the following:
+ meson dist --allow-dirty --no-tests --formats gztar
WARNING: Repository has uncommitted changes that will not be included in the dist tarball
Created D:\a\scipy\scipy\.mesonpy-rct2q19y\meson-dist\SciPy-1.13.0.dev0.tar.gz
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\shutil.py", line 624, in _rmtree_unsafe
os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '.\\.mesonpy-rct2q19y\\meson-private\\cmake_scipy-openblas\\CMakeFiles\\CMakeScratch\\TryCompile-cewmca'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\tempfile.py", line 878, in onerror
_os.unlink(path)
PermissionError: [WinError 5] Access is denied: '.\\.mesonpy-rct2q19y\\meson-private\\cmake_scipy-openblas\\CMakeFiles\\CMakeScratch\\TryCompile-cewmca'
The logs then alternate between the two functions until reaching a recursion depth error. The issue appears to stem from the use of TemporaryDirectory
here. This is a known issue (python/cpython#79325) that should be fixed in the next releases of Python 3.11/3.12.
Once that fix is in, we can use the ignore_cleanup_errors
flag (docs here) to silence this on Windows systems, where failed file deletions are a known issue. I'll create a draft PR for that.