ArtificialGuyBR

Home / Blog / Fixing things

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.

9 sources cited Fixing things

TL;DR


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 claimWhat is actually true
Add git pull at the top of webui-user.bat for auto-updatesOfficial 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==versionStandard 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 WindowsSince 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

  1. Close the WebUI console window.
  2. In the repository root (stable-diffusion-webui/), delete the venv folder.
  3. Double-click webui-user.bat (Windows) or run ./webui.sh (Linux/macOS).
  4. 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.csvoutside 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:

VariablePurposeExample value
TORCH_COMMANDFull pip command for torch/torchvision/torchaudiopip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
REQS_FILEAlternate requirements filerequirements.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+)

FactDetail
Flag--xformers in COMMANDLINE_ARGS
InstallAutomatic via official wheel (since Jan 2023)<sup>4</sup>
Python requirement3.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 reinstallAdd --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:

StepA1111Forge
Update codegit pullupdate.bat (mandatory)
Launchwebui-user.batrun.bat
RepairDelete venvDelete 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.batrun.bat.


Common Errors and Fixes

SymptomCause (sourced)Fix
fatal: not a git repository after ZIP downloadZIP 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 updateHalf-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 updatesCUDA/torch/xformers version skew<sup>15</sup>Undo recent component changes, delete venv, relaunch
RequirementError storm on startupEnv out of sync with requirements_versions.txt<sup>16</sup>Delete venv and repositories folders, relaunch
xformers wheel mismatch after env changeGPU/Python combo incompatible with cached wheel<sup>11</sup>Launch with --reinstall-xformers --xformers, then remove the reinstall flag
Forge launches but bugs persistSkipped update.bat after extract<sup>12</sup>Run update.bat before first run.bat

Decision Table: Repair vs Reinstall

ScenarioRecommended pathSource
git pull → dependency errorsDelete venv, relaunch1
ZIP download → git commands failConvert to git repo (commands above)13
Offline / air-gapped machineSet TORCH_COMMAND + REQS_FILE to local .whl paths5
Forge fresh extractRun update.batrun.bat12
xformers NameError on WindowsPython ≠ 3.10; install 3.10.6 + add to PATH9
Model corruption (MetadataIncompleteBuffer)Re-download checkpoint/safetensors17

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 &lt;hash&gt; 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

  1. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — official recovery steps, venv deletion, GPU troubleshooting, ZIP git fix, NaN/black-screen mitigations, xformers reinstall flag.
  2. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs> — Windows install prerequisites, COMMANDLINE_ARGS examples, default local URL.
  3. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings> — environment variables and CLI flags.
  4. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers> — Jan 2023 wheel transition, Windows manual-build history.
  5. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings> — COMMANDLINE_ARGS usage examples including xformers.
  6. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings> — --models-dir, --ckpt-dir, --styles-file, --ui-config-file, --ui-settings-file paths proving user data lives outside venv.
  7. <https://www.civitai.com/articles/1024> — community repair guide recommending venv deletion and manual pip diff.
  8. <https://download.pytorch.org/whl/cu121> — official PyTorch CUDA 12.1 wheel index listing torch, torchvision, torchaudio, xformers.
  9. <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).
  10. <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.
  11. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — --reinstall-xformers flag usage.
  12. <https://github.com/lllyasviel/stable-diffusion-webui-forge#installing-forge> — Forge one-click package, mandatory update.bat, run.bat, advanced git-clone method.
  13. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — fatal: not a git repository after ZIP extraction and git restore commands.
  14. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — NaN, black/green screens, --no-half-vae, --upcast-sampling mitigations.
  15. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — Torch unable to use GPU after updates; venv deletion fix.
  16. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — reinstall from scratch: delete venv, repositories.
  17. <https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting> — model corruption (MetadataIncompleteBuffer, PytorchStreamReader) and redownload guidance.