meson-python: building sdist fails with CMake subproject
Traceback:
$ python -m build --no-isolation -x -Csetup-args="-Duse-pythran=false"
...
+ meson setup D:\a\scipy\scipy D:\a\scipy\scipy\.mesonpy-nmuol9tn -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Duse-pythran=false --native-file=D:\a\scipy\scipy\.mesonpy-nmuol9tn\meson-python-native-file.ini
...
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 373, in <module>
main()
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 357, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 326, in build_sdist
return backend.build_sdist(sdist_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\mesonpy\__init__.py", line 1020, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\mesonpy\__init__.py", line 1061, in build_sdist
with _project(config_settings) as project:
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\contextlib.py", line 144, in __exit__
next(self.gen)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\mesonpy\__init__.py", line 944, in _project
with contextlib.ExitStack() as ctx:
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\contextlib.py", line 601, in __exit__
raise exc_details[1]
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\contextlib.py", line 586, in __exit__
if cb(*exc_details):
^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 943, in __exit__
self.cleanup()
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 947, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 929, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 787, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 629, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 629, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 629, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
[Previous line repeated 1 more time]
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 638, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 919, in onerror
cls._rmtree(path, ignore_errors=ignore_errors,
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 929, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 787, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 638, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 919, in onerror
cls._rmtree(path, ignore_errors=ignore_errors,
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\tempfile.py", line 929, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 787, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 638, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\shutil.py", line 636, in _rmtree_unsafe
os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '.\\.mesonpy-nmuol9tn\\meson-private\\cmake_boost_math\\CMakeFiles\\CMakeScratch'
ERROR Backend subprocess exited when trying to invoke build_sdist
Full log: https://github.com/scipy/scipy/actions/runs/10884814141/job/30200964434?pr=21270
x-ref scipy/scipy#21270
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (5 by maintainers)
I don’t see how this has anything to do with the change cited? I’m not at all a Windows expert, but I do seem to recall running into files “locked” by the OS longer than you’d expect is a thing that can happen when compiling code. Maybe try asking on a more general CMake forum, especially one that gets more Windows users?
Well, cmake’s normal means of operation when configuring a cmake build, is for the cmake equivalent of meson’s
cc.links()to produce a tiny ninja/make project in${CMAKE_BINARY_DIR}/CMakeFiles/CMakeScratch/<random_name>and then try building that and checking if the ninja/make project succeeds.This may be a recursion issue – but I have no idea what or how cmake waits on its own subprocesses. Perhaps a sub-cmake is still lingering?
CMakeScratch is a definite red flag though because a directory filename as specific as that is absolutely 100% a cmake internal and meson doesn’t touch it either. And cmake claims it cleans that up automatically as part of its own configure stage before exiting.
Not building but just configuring. Sub-projects are not build, only configured, to create an sdist. I saw the path in the stack trace. But I have no idea what may keep that file busy. The only process executed by meson-python is meson. And meson is a single process Python application, thus parts of it are for sure not lingering around. For configuring a CMake subproject, meson executes cmake, but I’m pretty sure it waits for the child process to exit before continuing. Thus it is either a process started by CMake that stays around, or it is some weird Windows thing where something interposes between the process opening the file and the filesystem.