From b45c40be6a8e81bd8d86d5abdb5bef4d7580c1dc Mon Sep 17 00:00:00 2001 From: Alfir Date: Mon, 28 Sep 2026 22:40:36 +0800 Subject: [PATCH] Fix Windows PermissionError in get_llama_cpp() by using shutil.move instead of pathlib.replace --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1122c363..fc2cc227 100644 --- a/setup.py +++ b/setup.py @@ -404,7 +404,9 @@ def get_llama_cpp(): f.extractall(tmp) top = next(tmp.iterdir()) shutil.rmtree(llama, ignore_errors=True) - top.replace(llama) + # pathlib.Path.replace() can fail on Windows with PermissionError + # when file handles or AV locks persist; use shutil.move instead. + shutil.move(str(top), str(llama.parent)) shutil.rmtree(tmp, ignore_errors=True) z.unlink(missing_ok=True) z.with_name(z.name + ".done").unlink(missing_ok=True)