AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
143.65k stars 27.03k forks source link

[Bug]: Can't install and run on Apple Silicon. #12866

Open wsq194 opened 1 year ago

wsq194 commented 1 year ago

Is there an existing issue for this?

What happened?

I followed the instructions at https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon, but the webui cannot be started and run.

Steps to reproduce the problem

1、If Homebrew is not installed, follow the instructions at https://brew.sh/ to install it. Keep the terminal window open and follow the instructions under "Next steps" to add Homebrew to your PATH. 2、Open a new terminal window and run brew install cmake protobuf rust python@3.10 git wget 3、Clone the web UI repository by running git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui 4、Place Stable Diffusion models/checkpoints you want to use into . If you don't have any, see Downloading Stable Diffusion Models below.stable-diffusion-webui/models/Stable-diffusion 5、cd stable-diffusion-webui and then to run the web UI. A Python virtual environment will be created and activated using venv and any remaining missing dependencies will be automatically downloaded and installed../webui.sh

What should have happened?

After following the complete steps, you should be able to start webui.

Version or Commit where the problem happens

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

MacOS

What device are you running WebUI on?

Other GPUs

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

List of extensions

Console logs

Last login: Wed Aug 30 16:10:58 on ttys000
lingjitong@Jun-iMac ~ % export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
lingjitong@Jun-iMac ~ % brew install cmake protobuf rust python@3.10 git wget

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/formula.jws.jso
#=#=#                                                                          
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/cask.jws.json

Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
Warning: cmake 3.27.4 is already installed and up-to-date.
To reinstall 3.27.4, run:
  brew reinstall cmake
Warning: protobuf 24.2 is already installed and up-to-date.
To reinstall 24.2, run:
  brew reinstall protobuf
Warning: rust 1.71.1 is already installed and up-to-date.
To reinstall 1.71.1, run:
  brew reinstall rust
Warning: python@3.10 3.10.13 is already installed and up-to-date.
To reinstall 3.10.13, run:
  brew reinstall python@3.10
Warning: git 2.42.0 is already installed and up-to-date.
To reinstall 2.42.0, run:
  brew reinstall git
Warning: wget 1.21.4 is already installed and up-to-date.
To reinstall 1.21.4, run:
  brew reinstall wget
lingjitong@Jun-iMac ~ % clear

lingjitong@Jun-iMac ~ % cd /Users/lingjitong/Desktop/sd 
lingjitong@Jun-iMac sd % git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

正克隆到 'stable-diffusion-webui'...
remote: Enumerating objects: 26942, done.
remote: Counting objects: 100% (371/371), done.
remote: Compressing objects: 100% (192/192), done.
remote: Total 26942 (delta 230), reused 276 (delta 179), pack-reused 26571
接收对象中: 100% (26942/26942), 32.15 MiB | 4.75 MiB/s, 完成.
处理 delta 中: 100% (18859/18859), 完成.
lingjitong@Jun-iMac sd % ls
stable-diffusion-webui
lingjitong@Jun-iMac sd % cd /Users/lingjitong/Desktop/sd/stable-diffusion-webui  
lingjitong@Jun-iMac stable-diffusion-webui % ./webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on lingjitong user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Python 3.10.13 (main, Aug 24 2023, 22:43:20) [Clang 14.0.0 (clang-1400.0.29.202)]
Version: v1.5.2
Commit hash: c9c8485bc1e8720aba70f029d25cba1c4abf2b5c
Installing torch and torchvision
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torch==2.0.1
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5a/77/778954c0aad4f7901a1ba02a129bca7467c64a19079108e6b1d6ce8ae575/torch-2.0.1-cp310-none-macosx_11_0_arm64.whl (55.8 MB)
Collecting torchvision==0.15.2
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d2/bf/4cd5133120e6cbcc2fa5c38c92f2f44a7486a9d2ae851e3d5a7e83f396d5/torchvision-0.15.2-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB)
Collecting filelock (from torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/52/90/45223db4e1df30ff14e8aebf9a1bf0222da2e7b49e53692c968f36817812/filelock-3.12.3-py3-none-any.whl (11 kB)
Collecting typing-extensions (from torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl (33 kB)
Collecting sympy (from torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d2/05/e6600db80270777c4a64238a98d442f0fd07cc8915be2a1c16da7f2b9e74/sympy-1.12-py3-none-any.whl (5.7 MB)
Collecting networkx (from torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a8/05/9d4f9b78ead6b2661d6e8ea772e111fc4a9fbd866ad0c81906c11206b55e/networkx-3.1-py3-none-any.whl (2.1 MB)
Collecting jinja2 (from torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/bc/c3/f068337a370801f372f2f8f6bad74a5c140f6fda3d9de154052708dd3c65/Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting numpy (from torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c3/ea/1d95b399078ecaa7b5d791e1fdbb3aee272077d9fd5fb499593c87dec5ea/numpy-1.25.2-cp310-cp310-macosx_11_0_arm64.whl (14.0 MB)
Collecting requests (from torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl (62 kB)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ef/53/024e161112beb11008d6c7529c954e2ec641ae17b99e03fe9a539e114ae6/Pillow-10.0.0-cp310-cp310-macosx_11_0_arm64.whl (3.1 MB)
Collecting MarkupSafe>=2.0 (from jinja2->torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/20/1d/713d443799d935f4d26a4f1510c9e61b1d288592fb869845e5cc92a1e055/MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_universal2.whl (17 kB)
Collecting charset-normalizer<4,>=2 (from requests->torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ec/a7/96835706283d63fefbbbb4f119d52f195af00fc747e67cc54397c56312c8/charset_normalizer-3.2.0-cp310-cp310-macosx_11_0_arm64.whl (124 kB)
Collecting idna<4,>=2.5 (from requests->torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<3,>=1.21.1 (from requests->torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/9b/81/62fd61001fa4b9d0df6e31d47ff49cfa9de4af03adecf339c7bc30656b37/urllib3-2.0.4-py3-none-any.whl (123 kB)
Collecting certifi>=2017.4.17 (from requests->torchvision==0.15.2)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4c/dd/2234eab22353ffc7d94e8d13177aaa050113286e93e7b40eae01fbf7c3d9/certifi-2023.7.22-py3-none-any.whl (158 kB)
Collecting mpmath>=0.19 (from sympy->torch==2.0.1)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/43/e3/7d92a15f894aa0c9c4b49b8ee9ac9850d6e63b03c9c32c0367a13ae62209/mpmath-1.3.0-py3-none-any.whl (536 kB)
Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, charset-normalizer, certifi, requests, jinja2, filelock, torch, torchvision
Successfully installed MarkupSafe-2.1.3 certifi-2023.7.22 charset-normalizer-3.2.0 filelock-3.12.3 idna-3.4 jinja2-3.1.2 mpmath-1.3.0 networkx-3.1 numpy-1.25.2 pillow-10.0.0 requests-2.31.0 sympy-1.12 torch-2.0.1 torchvision-0.15.2 typing-extensions-4.7.1 urllib3-2.0.4
Installing gfpgan
Traceback (most recent call last):
  File "/Users/lingjitong/Desktop/sd/stable-diffusion-webui/launch.py", line 39, in <module>
    main()
  File "/Users/lingjitong/Desktop/sd/stable-diffusion-webui/launch.py", line 30, in main
    prepare_environment()
  File "/Users/lingjitong/Desktop/sd/stable-diffusion-webui/modules/launch_utils.py", line 320, in prepare_environment
    run_pip(f"install {gfpgan_package}", "gfpgan")
  File "/Users/lingjitong/Desktop/sd/stable-diffusion-webui/modules/launch_utils.py", line 136, in run_pip
    return run(f'"{python}" -m pip {command} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live)
  File "/Users/lingjitong/Desktop/sd/stable-diffusion-webui/modules/launch_utils.py", line 113, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install gfpgan.
Command: "/Users/lingjitong/Desktop/sd/stable-diffusion-webui/venv/bin/python3.10" -m pip install https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip --prefer-binary
Error code: 1
stdout: Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip
  Using cached https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip (6.0 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting basicsr>=1.4.2 (from gfpgan==1.3.5)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/86/41/00a6b000f222f0fa4c6d9e1d6dcc9811a374cabb8abb9d408b77de39648c/basicsr-1.4.2.tar.gz (172 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting facexlib>=0.2.5 (from gfpgan==1.3.5)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/7b/2147339dafe1c4800514c9c21ee4444f8b419ce51dfc7695220a8e0069a6/facexlib-0.3.0-py3-none-any.whl (59 kB)
Collecting lmdb (from gfpgan==1.3.5)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/de/13/dd9b0c1924f0becc93e0bacd123a4e7a347966e3e74753ace3b1e85acc39/lmdb-1.4.1.tar.gz (881 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from gfpgan==1.3.5) (1.25.2)
Collecting opencv-python (from gfpgan==1.3.5)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/32/a6/4321f0f30ee11d6d85f49251d417f4e885fe7638b5ac50b7e3c80cccf141/opencv_python-4.8.0.76-cp37-abi3-macosx_11_0_arm64.whl (33.1 MB)
Collecting pyyaml (from gfpgan==1.3.5)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5b/07/10033a403b23405a8fc48975444463d3d10a5c2736b7eb2550b07b367429/PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl (169 kB)
Collecting scipy (from gfpgan==1.3.5)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/63/b9/0344b60e7c577eb637785841222fde8ef7928ec4797be1a34ca39bfe31dc/scipy-1.11.2-cp310-cp310-macosx_12_0_arm64.whl (29.6 MB)
INFO: pip is looking at multiple versions of gfpgan to determine which version is compatible with other requirements. This could take a while.

stderr: ERROR: Ignored the following versions that require a different python version: 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10
ERROR: Could not find a version that satisfies the requirement tb-nightly (from gfpgan) (from versions: none)
ERROR: No matching distribution found for tb-nightly

Additional information

operating system:macOX Monterey-12.2.1

mikecastrodemaria commented 1 year ago

Have you tried to install gfpgan using pip manualy and restart the instal process ? Mine is :

Name: gfpgan Version: 1.3.8 Summary: GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration Home-page: https://github.com/TencentARC/GFPGAN Author: Xintao Wang Author-email: xintao.wang@outlook.com License: Apache License Version 2.0 Location: /opt/homebrew/lib/python3.11/site-packages Requires: basicsr, facexlib, lmdb, numpy, opencv-python, pyyaml, scipy, tb-nightly, torch, torchvision, tqdm, yapf Required-by: realesrgan

akx commented 1 year ago

This is likely related to the PyPI mirror you're using, https://pypi.tuna.tsinghua.edu.cn/.

csjasonleung commented 1 year ago

Not sure if I remember correctly. It seems that I had similar issues before. Perhaps you may try upgrading your macOS to Ventura.

StruggleYang commented 1 year ago

pip config unset global.index-url and try

spencer17x commented 1 year ago

try: pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

rachelcenter commented 4 months ago

I'm following this tutorial to install stable diffusion https://www.youtube.com/watch?v=Jh-clc4jEvk and when I type in ./webui.sh it tells me I have an incompatible python version. ("This program is tested with 3.10.6 Python, but you have 3.12.4.") It tells me a website where I can download an earlier version of python but why downgrade? Is that the only way to make stable diffusion work? or can I have 2 versions of python installed at once??

I know it says to type --skip-python-version-check to suppress this warning, but I'm very new to this world of coding and I'm little nervous to make that warning go away. (Using a Mac computer btw).

It's also telling me at the end to update pip (pip install --upgrade pip) but I did that command a few minutes ago and updated it, then i re-ran the stable diffusion command and now its back to telling me again to update it when its been updated. This is maddening