Install once, properly
A local setup is a Python environment, a PyTorch build matched to your hardware, an interface, and at least one checkpoint. Most guides cover the happy path. This lesson covers the four places it stops.
Use a virtual environment. Always. Not because it is tidy, but because two interfaces will want incompatible versions of the same library, and without isolation the second install silently breaks the first.
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
python --version # 3.10 or 3.11; 3.13 still breaks thingsThe Python version matters more than people expect. Much of this ecosystem pins to 3.10, and installing on the newest release is a reliable way to meet a compiled dependency that has no wheel for your version and tries to build from source.
Error one: “Torch not compiled with CUDA enabled”
You installed PyTorch with a plain pip install torch, which on many systems gives you the CPU-only build. Generation then either refuses or runs at roughly one image every four minutes.
The fix is to install the build that matches your hardware, from PyTorch’s own index:
# Nvidia
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
# AMD on Linux
pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.0
# Apple Silicon: the default build already has Metal supportVerify before you go further. python -c "import torch; print(torch.cuda.is_available())" printing False on an Nvidia machine means stop and fix this now, not after installing four extensions.
Error two: “CUDA out of memory”
The message names a number: it tried to allocate, say, 2.14 GiB and had 1.87 GiB free. That number is the useful part. In order of what to try:
- Lower the resolution. Memory scales roughly with pixel count, so 1024×1024 to 768×768 is a 44% cut.
- Reduce batch size to 1. A batch of four costs close to four times the activation memory.
- Enable medium or low VRAM mode (
--medvram,--lowvramin Forge;--lowvramin ComfyUI). - Turn on tiled VAE. Decoding is often the peak, not sampling, which is why a generation gets to 100% and then crashes.
That last point is the one people miss. If the progress bar completes and the failure comes after, it is the decoder, and tiled VAE fixes it without touching anything else.
Error three: the mismatched extension
An extension installs a different version of a library the interface already uses, and the whole thing stops starting. The symptom is a stack trace naming a package you never installed deliberately.
The cure is prevention: install extensions one at a time, and start the interface after each one. When something breaks you know exactly what did it, and you can delete that one folder. Installing six and then debugging is a miserable afternoon.
Error four: it works, and looks nothing like the tutorial
Your setup is fine. You have a different checkpoint, or a different sampler default, or the tutorial used a hidden style preset. Diffusion output is extremely sensitive to configuration, and “wrong” here almost never means broken.
Before concluding anything, reproduce a known image: take a picture with embedded metadata from a model’s own page, copy every parameter including sampler, steps, CFG, seed, size and model hash, and generate. If you get their image, your install is correct and your differences are parameters. If you do not, compare hashes: you are probably on a different checkpoint with the same name, which happens constantly because everyone re-uploads everything.
The one that is not your fault
On Windows with an Nvidia card, the driver will, by default, spill VRAM into system RAM instead of raising an out-of-memory error. Generation does not crash; it becomes twenty times slower, with no message. If your speed collapses after loading a second model and nothing errors, this is it. Turn off “CUDA system memory fallback” in the Nvidia control panel and you will get a clean error instead of a mystery.
The half hour that pays for itself
Once it runs, do three things before you start real work.
Generate a known image and keep it. Pick one prompt, one seed, one checkpoint, and save the result as reference.png in the install folder. After every update, regenerate it. If it differs, something changed, and you have found out in ten seconds rather than in the middle of a client revision.
Write down where the models live. One text file with the folder paths and what goes in each. You will be adding a second interface within a month, and pointing it at the same folders instead of downloading everything again saves tens of gigabytes.
Turn on metadata saving and PNG output. Most interfaces do this by default, but check. A JPEG delivered to a client is disposable; a PNG with the full parameter block in it is the only record of how the image was made, and the next block’s whole working method depends on having it.
Where to ask when it breaks
An install failure is almost never unique to you. Paste the exact final line of the error into a search, not your description of the symptom. “It doesn’t work” finds nothing; AssertionError: Torch not compiled with CUDA enabled finds the answer as the first result, because several thousand people have already hit it. The project issue trackers on GitHub are searchable and usually contain a closed issue with the fix in the second comment.
Every lesson here is open. Your progress is recorded once you pass the Vectors, Logos and Things That Get Printed exam.
Check your understanding
A local SDXL generation reaches 100% on the progress bar and then fails with a CUDA out-of-memory error. What does the timing tell you?
Pick the one you would defend. Your answer stays private.
Stuck on something?Ask Neema, your AI tutor
