Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows TemporaryDirectory cleanup #559

Closed
thalassemia opened this issue Jan 11, 2024 · 0 comments
Closed

Fix Windows TemporaryDirectory cleanup #559

thalassemia opened this issue Jan 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@thalassemia
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants