-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
leon-wulin edited this page Aug 5, 2025
·
7 revisions
Two ways to get the backend running.
Recommended – Automated script (GPU ⬅︎→ CPU auto-detect).
Alternative – Manual install for locked-down networks or custom tuning.
conda create -n easy_art python=3.10 -y
conda activate easy_art| Platform | Command | What the script does |
|---|---|---|
| Linux / macOS / WSL | bash setup_unix.sh |
• Detect GPU → install cu121/cu118 wheels, else CPU wheels \n• Clone Automatic1111 repo \n• Install pinned deps \n• Download default SD-1.5 (v1-5-pruned.safetensors) |
| Windows (PowerShell) | Set-ExecutionPolicy -Scope Process RemoteSigned; .\setup_windows.ps1 |
Performs the same steps, CUDA-aware or CPU-only |
Scripts live in the repo root (or
scripts/if you moved them). Both scripts print ✅ Done and a “Next steps” block.
# Start local A1111 (GPU or CPU-only)
python program_main/serve_local_sd.py --port 7860
# Unified backend smoke test
python program_main/backend_main.py
# Enter a description; the generated image will open automatically.Follow this if scripts are blocked or you need different versions.
conda create -n easy_art python=3.10 -y
conda activate easy_art| Scenario | Command |
|---|---|
| CUDA 12.x GPU | pip install --index-url https://download.pytorch.org/whl/cu121 torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 |
| CUDA 11.x GPU | pip install --index-url https://download.pytorch.org/whl/cu118 torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 |
| CPU-only | pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision torchaudio |
pip install numpy==1.26.4 scipy==1.11.4 pandas==1.5.3 \
matplotlib==3.7.2 kiwisolver==1.4.5 orjson==3.9.10 \
fastapi gradio==3.41.2 uvicorn pillow==9.5.0 tqdm \
transformers==4.39.3 diffusers==0.27.2 accelerate==0.27.2 \
pyyaml addict safetensors==0.4.2 requests psutil python-dotenv
# Optional GPU speed-up:
pip install xformers # ignore if it fails on CPUgit clone --depth 1 https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
mkdir -p stable-diffusion-webui/models/Stable-diffusion
curl -L -o stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned.safetensors \
https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensorspython program_main/serve_local_sd.py --port 7860
python program_main/backend_main.pyIf you see “WebUI is ready at http://127.0.0.1:7860” and an image opens, the install succeeded.
| Symptom | Fix |
|---|---|
404 /sdapi/v1/txt2img right after start |
Normal — backend auto-retries; wait ~2s. |
ModuleNotFoundError: numpy._core... |
pip install --force-reinstall numpy |
cannot import name '_c_internal_utils' from matplotlib |
pip install --force-reinstall matplotlib kiwisolver |
| Torch “not compiled with CUDA” on a GPU box | Ensure the wheel matches CUDA (cu121/cu118); uninstall & reinstall torch/vision/audio. |
| Port 7860 stuck |
lsof -i:7860 (Linux) / `netstat -ano ^ |
LOCAL_SD_HOST=http://127.0.0.1:7860
MODELSLAB_API_KEY=xxxxxxxxxxxxxxxx # only needed for cloud SDfrom backend_main import start_local_server, generate_image_from_prompt, stop_local_server
start_local_server() # idempotent, loads default SD-1.5
urls = generate_image_from_prompt("cat astronaut, anime style", model="local")
print(urls[0])
stop_local_server()