diff --git a/cli/commands/studio.py b/cli/commands/studio.py index 45b2e4fd13..c13de30ba0 100644 --- a/cli/commands/studio.py +++ b/cli/commands/studio.py @@ -294,7 +294,13 @@ def _build_llama_cpp(): typer.echo(" Building llama.cpp for GGUF inference...") if llama_dir.exists(): - shutil.rmtree(llama_dir) + # necessary because shutil.rmtree fails on Windows because .git pack files are read-only + def _force_remove_readonly(func, path, exc_info): + """Clear read-only flag and retry — needed on Windows for .git pack files.""" + import stat + os.chmod(path, stat.S_IWRITE) + func(path) + shutil.rmtree(llama_dir, onerror=_force_remove_readonly) unsloth_home.mkdir(parents = True, exist_ok = True) result = subprocess.run(