{"course":{"slug":"ai-images","title":"Image Generation, in Practice","url":"https://addaly.com/learn/ai-images","level":"beginner","track":"create"},"lesson":{"slug":"the-first-hour","title":"The first hour, and the four errors everybody gets","url":"https://addaly.com/learn/ai-images/the-first-hour","position":6,"of":69,"minutes":8,"answer":"Almost every failed local install is one of four specific errors, each with a one-line cause, and knowing them turns a lost weekend into twenty minutes.","keyIdea":"Almost every failed local install is one of four specific errors, each with a one-line cause, and knowing them turns a lost weekend into twenty minutes."},"body":{"format":"markdown","text":"## Install once, properly\n\nA 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.\n\nUse 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.\n\n```bash\npython -m venv venv\nsource venv/bin/activate      # Windows: venv\\Scripts\\activate\npython --version              # 3.10 or 3.11; 3.13 still breaks things\n```\n\nThe 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.\n\n## Error one: \"Torch not compiled with CUDA enabled\"\n\nYou 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.\n\nThe fix is to install the build that matches your hardware, from PyTorch's own index:\n\n```bash\n# Nvidia\npip install torch torchvision --index-url https://download.pytorch.org/whl/cu121\n# AMD on Linux\npip install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.0\n# Apple Silicon: the default build already has Metal support\n```\n\nVerify 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.\n\n## Error two: \"CUDA out of memory\"\n\nThe 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:\n\n1. Lower the resolution. Memory scales roughly with pixel count, so 1024×1024 to 768×768 is a 44% cut.\n2. Reduce batch size to 1. A batch of four costs close to four times the activation memory.\n3. Enable medium or low VRAM mode (`--medvram`, `--lowvram` in Forge; `--lowvram` in ComfyUI).\n4. Turn on tiled VAE. Decoding is often the peak, not sampling, which is why a generation gets to 100% and *then* crashes.\n\nThat 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.\n\n## Error three: the mismatched extension\n\nAn 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.\n\nThe 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.\n\n## Error four: it works, and looks nothing like the tutorial\n\nYour 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.\n\nBefore 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.\n\n## The one that is not your fault\n\nOn 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.\n\n## The half hour that pays for itself\n\nOnce it runs, do three things before you start real work.\n\n**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.\n\n**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.\n\n**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.\n\n## Where to ask when it breaks\n\nAn 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."},"check":{"question":"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?","options":[{"text":"Nothing useful, because an out-of-memory failure has one cause and one remedy, which is to generate the image at a smaller resolution and try again.","correct":false,"tempting":"Discards the most diagnostic piece of information available, and resolution is only one of four levers, applied here to the wrong stage."},{"text":"The batch size is too high, since a batch allocates memory for all of its images together at the point where they are written out.","correct":false,"tempting":"Batching multiplies memory throughout sampling, not at the end, so a batch problem fails early rather than after the bar completes."},{"text":"The peak is the VAE decode that runs after sampling, so tiled decoding is the targeted fix.","correct":true},{"text":"The checkpoint itself is too large for this card, so it has to be quantised to a smaller format before any other change will make a difference.","correct":false,"tempting":"Loading happens before sampling, so a checkpoint that did not fit would have failed at 0%, not at 100%."}]},"prev":{"slug":"picking-an-interface","title":"Four front ends, and which one deserves your learning time","url":"https://addaly.com/learn/ai-images/picking-an-interface"},"next":{"slug":"speed-and-steps","title":"Steps, samplers and the seconds you should actually expect","url":"https://addaly.com/learn/ai-images/speed-and-steps"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Exam keys checked blind by a second model: 3,665 of 3,666 agreed. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'The first hour, and the four errors everybody gets', in Image Generation, in Practice. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/ai-images/the-first-hour (Accessed: 13 October 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"The first hour, and the four errors everybody gets","courseTitle":"Image Generation, in Practice","module":{"index":1,"slug":"the-kit","title":"The kit, and what each piece of it costs you"},"answer":null,"keyIdea":"Almost every failed local install is one of four specific errors, each with a one-line cause, and knowing them turns a lost weekend into twenty minutes.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"install-once-properly","runs":[{"text":"Install once, properly"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"code","lang":"bash","label":"Bash","text":"python -m venv venv\nsource venv/bin/activate      # Windows: venv\\Scripts\\activate\npython --version              # 3.10 or 3.11; 3.13 still breaks things"},{"t":"p","runs":[{"text":"The 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."}]},{"t":"h2","id":"error-one-torch-not-compiled-with-cuda-enabled","runs":[{"text":"Error one: “Torch not compiled with CUDA enabled”"}]},{"t":"p","runs":[{"text":"You installed PyTorch with a plain "},{"text":"pip install torch","code":true},{"text":", which on many systems gives you the CPU-only build. Generation then either refuses or runs at roughly one image every four minutes."}]},{"t":"p","runs":[{"text":"The fix is to install the build that matches your hardware, from PyTorch’s own index:"}]},{"t":"code","lang":"bash","label":"Bash","text":"# Nvidia\npip install torch torchvision --index-url https://download.pytorch.org/whl/cu121\n# AMD on Linux\npip install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.0\n# Apple Silicon: the default build already has Metal support"},{"t":"p","runs":[{"text":"Verify before you go further. "},{"text":"python -c \"import torch; print(torch.cuda.is_available())\"","code":true},{"text":" printing "},{"text":"False","code":true},{"text":" on an Nvidia machine means stop and fix this now, not after installing four extensions."}]},{"t":"h2","id":"error-two-cuda-out-of-memory","runs":[{"text":"Error two: “CUDA out of memory”"}]},{"t":"p","runs":[{"text":"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:"}]},{"t":"ol","start":1,"items":[[{"text":"Lower the resolution. Memory scales roughly with pixel count, so 1024×1024 to 768×768 is a 44% cut."}],[{"text":"Reduce batch size to 1. A batch of four costs close to four times the activation memory."}],[{"text":"Enable medium or low VRAM mode ("},{"text":"--medvram","code":true},{"text":", "},{"text":"--lowvram","code":true},{"text":" in Forge; "},{"text":"--lowvram","code":true},{"text":" in ComfyUI)."}],[{"text":"Turn on tiled VAE. Decoding is often the peak, not sampling, which is why a generation gets to 100% and "},{"text":"then","i":true},{"text":" crashes."}]]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"error-three-the-mismatched-extension","runs":[{"text":"Error three: the mismatched extension"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"error-four-it-works-and-looks-nothing-like-the-tutorial","runs":[{"text":"Error four: it works, and looks nothing like the tutorial"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"the-one-that-is-not-your-fault","runs":[{"text":"The one that is not your fault"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"the-half-hour-that-pays-for-itself","runs":[{"text":"The half hour that pays for itself"}]},{"t":"p","runs":[{"text":"Once it runs, do three things before you start real work."}]},{"t":"p","runs":[{"text":"Generate a known image and keep it.","b":true},{"text":" Pick one prompt, one seed, one checkpoint, and save the result as "},{"text":"reference.png","code":true},{"text":" 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."}]},{"t":"p","runs":[{"text":"Write down where the models live.","b":true},{"text":" 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."}]},{"t":"p","runs":[{"text":"Turn on metadata saving and PNG output.","b":true},{"text":" 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."}]},{"t":"h2","id":"where-to-ask-when-it-breaks","runs":[{"text":"Where to ask when it breaks"}]},{"t":"p","runs":[{"text":"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; "},{"text":"AssertionError: Torch not compiled with CUDA enabled","code":true},{"text":" 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."}]}],"check":{"question":[{"text":"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?"}],"options":[{"text":[{"text":"Nothing useful, because an out-of-memory failure has one cause and one remedy, which is to generate the image at a smaller resolution and try again."}],"correct":false,"tempting":[{"text":"Discards the most diagnostic piece of information available, and resolution is only one of four levers, applied here to the wrong stage."}]},{"text":[{"text":"The batch size is too high, since a batch allocates memory for all of its images together at the point where they are written out."}],"correct":false,"tempting":[{"text":"Batching multiplies memory throughout sampling, not at the end, so a batch problem fails early rather than after the bar completes."}]},{"text":[{"text":"The peak is the VAE decode that runs after sampling, so tiled decoding is the targeted fix."}],"correct":true,"tempting":null},{"text":[{"text":"The checkpoint itself is too large for this card, so it has to be quantised to a smaller format before any other change will make a difference."}],"correct":false,"tempting":[{"text":"Loading happens before sampling, so a checkpoint that did not fit would have failed at 0%, not at 100%."}]}],"order":[1,3,0,2],"why":null},"prev":{"slug":"picking-an-interface","title":"Four front ends, and which one deserves your learning time","minutes":8},"next":{"slug":"speed-and-steps","title":"Steps, samplers and the seconds you should actually expect","minutes":8}}}