Fix Automatic1111 Git Pull Break: Venv Reset and Rollback
Fix A1111 after a broken git pull by deleting venv — the official upstream path. Covers Forge repair, xformers speed gains, and what survives the reset.
On this page
TL;DR
- Delete
venvfirst — the official A1111 docs listvenvdeletion as the canonical repair path; it is faster than hand-pinning packages. - Models and settings survive — they live in
models/,config.json,ui-config.json,styles.csvoutside the virtual environment ([see /INTERNAL:models-folders]). - Forge requires
update.bat— skip it and you run a stale build with unfixed bugs ([see /INTERNAL:forge-vs-a1111]).
Why git pull Breaks Automatic1111
A git pull updates the Python code and extensions but does not rebuild the virtual environment. If upstream changed a dependency version — PyTorch, xformers, Gradio, anything in requirements_versions.txt — the old wheels inside venv now mismatch the new import statements. The launcher prints a wall of RequirementError or ImportError and exits.
The A1111 Troubleshooting wiki states it plainly: "If you encounter this issue after some component updates, try undoing the most recent actions. … you should delete the venv folder."<sup>1</sup> That is the entire rollback playbook from upstream.
What the Civitai Articles Get Wrong
| Source claim | What is actually true |
|---|---|
Add git pull at the top of webui-user.bat for auto-updates | Official docs never mention this. The wiki treats webui-user.bat as a launcher config, not an update script.<sup>2</sup> |
Pip command is pip Install -U packagename==version | Standard pip is lowercase: pip install -U. The capitalized form is a typo in the community article.<sup>3</sup> |
| xformers still needs manual build on Windows | Since January 23, 2023, Windows uses an official PyPI wheel — no Visual Studio build required.<sup>4</sup> |
"Edit webui.bat to install xformers" | The flag belongs in COMMANDLINE_ARGS (e.g. set COMMANDLINE_ARGS=--xformers --skip-torch-cuda-test).<sup>5</sup> |
Fastest Repair: Delete venv and Relaunch
- Close the WebUI console window.
- In the repository root (
stable-diffusion-webui/), delete thevenvfolder. - Double-click
webui-user.bat(Windows) or run./webui.sh(Linux/macOS). - The launcher recreates the virtual environment and installs the exact versions pinned in
requirements_versions.txt.
Why this works: A1111 isolates every Python package inside venv. The repo itself only holds code, extensions, and a few scripts. Your checkpoints, LoRAs, embeddings, and UI settings live in models/, embeddings/, config.json, ui-config.json, styles.csv — outside venv. Deleting venv never touches them.<sup>6</sup>
Community confirmation: Multiple guides (Civitai 1024, YouTube, Stack Overflow) recommend venv deletion as the first step after a broken pull.<sup>7</sup>
If the repair keeps fighting you, moving on is a valid answer — see leaving A1111 in 2026.
When You Must Reinstall PyTorch Manually
On slow or air-gapped connections, the launcher's automatic pip step can time out. A1111 exposes two environment variables for this:
| Variable | Purpose | Example value |
|---|---|---|
TORCH_COMMAND | Full pip command for torch/torchvision/torchaudio | pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 |
REQS_FILE | Alternate requirements file | requirements.txt (looser pins) |
Edit webui-user.bat / webui-user.sh and add:
set TORCH_COMMAND=pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
The cu121 index hosts official wheels for torch, torchvision, torchaudio, and xformers<sup>8</sup> — no third-party mirrors needed.
Once it runs again, the acceleration stack version matrix explains which xformers build matches your PyTorch.
xformers on Windows: Current State (2024+)
| Fact | Detail |
|---|---|
| Flag | --xformers in COMMANDLINE_ARGS |
| Install | Automatic via official wheel (since Jan 2023)<sup>4</sup> |
| Python requirement | 3.10.x — the wheel is built for CPython 3.10; older/newer Python fails<sup>9</sup> |
| Measured speedup | ~70 % higher throughput at batch 1 on RTX 3060 (6.5 → 7.5 it/s vs default 4.1 → 6.6 it/s)<sup>10</sup> |
| Force reinstall | Add --reinstall-xformers --xformers to COMMANDLINE_ARGS, launch once, then remove the reinstall flag<sup>11</sup> |
Forge: Different Update Workflow, Same Repair Logic
Forge bundles Git, Python, and a pinned PyTorch in a one-click 7z package. The critical difference:
| Step | A1111 | Forge |
|---|---|---|
| Update code | git pull | update.bat (mandatory) |
| Launch | webui-user.bat | run.bat |
| Repair | Delete venv | Delete venv or re-extract package |
Forge docs warn: "Running update.bat is important, otherwise you may be using a previous version with potential bugs unfixed."<sup>12</sup>
If update.bat was skipped, re-extract the 7z or delete venv and run update.bat → run.bat.
Common Errors and Fixes
| Symptom | Cause (sourced) | Fix |
|---|---|---|
fatal: not a git repository after ZIP download | ZIP lacks .git metadata<sup>13</sup> | Run git init; git remote add origin https://github.com/AUTOMATIC1111/stable-diffusion-webui.git; git fetch origin; git switch master --force |
Black/green screens or NaN after update | Half-precision/VAE mismatch post dependency change<sup>14</sup> | Add --upcast-sampling or --no-half-vae to COMMANDLINE_ARGS |
Torch is not able to use GPU after updates | CUDA/torch/xformers version skew<sup>15</sup> | Undo recent component changes, delete venv, relaunch |
RequirementError storm on startup | Env out of sync with requirements_versions.txt<sup>16</sup> | Delete venv and repositories folders, relaunch |
| xformers wheel mismatch after env change | GPU/Python combo incompatible with cached wheel<sup>11</sup> | Launch with --reinstall-xformers --xformers, then remove the reinstall flag |
| Forge launches but bugs persist | Skipped update.bat after extract<sup>12</sup> | Run update.bat before first run.bat |
Decision Table: Repair vs Reinstall
| Scenario | Recommended path | Source |
|---|---|---|
git pull → dependency errors | Delete venv, relaunch | 1 |
| ZIP download → git commands fail | Convert to git repo (commands above) | 13 |
| Offline / air-gapped machine | Set TORCH_COMMAND + REQS_FILE to local .whl paths | 5 |
| Forge fresh extract | Run update.bat → run.bat | 12 |
xformers NameError on Windows | Python ≠ 3.10; install 3.10.6 + add to PATH | 9 |
Model corruption (MetadataIncompleteBuffer) | Re-download checkpoint/safetensors | 17 |
FAQ
How do I roll back Automatic1111 after a bad git pull? Upstream does not publish a numbered git reset --hard playbook. The documented recovery is: undo recent actions, then delete venv.<sup>1</sup> If you know the good commit hash, git reset --hard <hash> works, but you must still delete venv afterward.
Will deleting venv erase my models and settings? No. Models live in models/Stable-diffusion/, LoRAs in models/Lora/, settings in config.json, ui-config.json, styles.csv — all at repo root, outside venv.<sup>6</sup> See also: Models and stable diffusion model folders — what survives a reinstall?
Why does the Civitai guide say to add git pull to webui-user.bat? That is a community workaround, not an official feature. The wiki never mentions it.<sup>2</sup>
Do I need Visual Studio Build Tools for xformers on Windows in 2024? No. Since January 2023, an official wheel installs via pip automatically when you launch with --xformers.<sup>4</sup>
What Python version does Automatic1111 require on Windows? 3.10.6 exactly. The installer checks for it; other versions cause xformers and torch wheels to fail.<sup>1</sup>
Forge vs Automatic1111 — which is easier to repair? Both reset via venv deletion. Forge adds a mandatory update.bat step; A1111 relies on git pull. No primary source claims Forge is faster to repair.<sup>12</sup>
Where do I put --xformers on Windows? Edit webui-user.bat, find set COMMANDLINE_ARGS=, append --xformers (space-separated). Example: set COMMANDLINE_ARGS=--xformers --skip-torch-cuda-test --autolaunch.<sup>5</sup>
My generated images are black/green after an update — what flag fixes it? Try --no-half-vae first; if that fails, --upcast-sampling or --no-half.<sup>14</sup>
Sources
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — official recovery steps,
venvdeletion, GPU troubleshooting, ZIP git fix, NaN/black-screen mitigations, xformers reinstall flag. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs> — Windows install prerequisites,
COMMANDLINE_ARGSexamples, default local URL. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings> — environment variables and CLI flags.
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers> — Jan 2023 wheel transition, Windows manual-build history.
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings> —
COMMANDLINE_ARGSusage examples including xformers. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings> —
--models-dir,--ckpt-dir,--styles-file,--ui-config-file,--ui-settings-filepaths proving user data lives outsidevenv. - <https://www.civitai.com/articles/1024> — community repair guide recommending
venvdeletion and manual pip diff. - <https://download.pytorch.org/whl/cu121> — official PyTorch CUDA 12.1 wheel index listing torch, torchvision, torchaudio, xformers.
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — "If you use Windows, this means your Python is too old. Use 3.10" (xformers wheel requirement).
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Optimizations> — benchmark table: xFormers 6.5/7.5 it/s vs Doggetx 4.1/6.6 it/s on RTX 3060.
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> —
--reinstall-xformersflag usage. - <https://github.com/lllyasviel/stable-diffusion-webui-forge#installing-forge> — Forge one-click package, mandatory
update.bat,run.bat, advanced git-clone method. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> —
fatal: not a git repositoryafter ZIP extraction and git restore commands. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — NaN, black/green screens,
--no-half-vae,--upcast-samplingmitigations. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — Torch unable to use GPU after updates;
venvdeletion fix. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — reinstall from scratch: delete
venv,repositories. - <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — model corruption (
MetadataIncompleteBuffer,PytorchStreamReader) and redownload guidance.