AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: ERROR: Cython compiler 'cython`on MacOS #9984

Open imagedubonheur opened 1 year ago

imagedubonheur commented 1 year ago

Is there an existing issue for this?

What happened?

step 01 I followed the steps for installing stable diffusion on mac m1, when I got to this command stable-diffusion-webui;./webui.sh I got the error provided beneath

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

The ability to have the local host running on the web

Commit where the problem happens

export K_DIFFUSION_COMMIT_HASH="51c9778f269cedb55a4d88c79c0246d35bdadb71"

What platforms do you use to access the UI ?

MacOS

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No

List of extensions

No

Console logs

cd ~/stable-diffusion-webui;./webui.sh

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

################################################################
Running on alaama user
################################################################

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

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

################################################################
Launching launch.py...
################################################################
Python 3.10.11 (main, Apr  7 2023, 07:20:55) [Clang 13.0.0 (clang-1300.0.29.30)]
Commit hash: 72cd27a13587c9579942577e9e3880778be195f6
Installing torch and torchvision
Collecting torch
  Downloading torch-2.0.0-cp310-none-macosx_11_0_arm64.whl (55.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.8/55.8 MB 978.4 kB/s eta 0:00:00
Collecting torchvision
  Downloading torchvision-0.15.1-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 921.1 kB/s eta 0:00:00
Collecting typing-extensions
  Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting sympy
  Using cached sympy-1.11.1-py3-none-any.whl (6.5 MB)
Collecting jinja2
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting networkx
  Using cached networkx-3.1-py3-none-any.whl (2.1 MB)
Collecting filelock
  Downloading filelock-3.12.0-py3-none-any.whl (10 kB)
Collecting requests
  Downloading requests-2.29.0-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.5/62.5 kB 1.1 MB/s eta 0:00:00
Collecting pillow!=8.3.*,>=5.3.0
  Using cached Pillow-9.5.0-cp310-cp310-macosx_11_0_arm64.whl (3.1 MB)
Collecting numpy
  Downloading numpy-1.24.3-cp310-cp310-macosx_11_0_arm64.whl (13.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.9/13.9 MB 217.4 kB/s eta 0:00:00
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/markupsafe/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))': /simple/markupsafe/
Collecting MarkupSafe>=2.0
  Using cached MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_universal2.whl (17 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.1.0-cp310-cp310-macosx_11_0_arm64.whl (123 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting mpmath>=0.19
  Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision
Successfully installed MarkupSafe-2.1.2 certifi-2022.12.7 charset-normalizer-3.1.0 filelock-3.12.0 idna-3.4 jinja2-3.1.2 mpmath-1.3.0 networkx-3.1 numpy-1.24.3 pillow-9.5.0 requests-2.29.0 sympy-1.11.1 torch-2.0.0 torchvision-0.15.1 typing-extensions-4.5.0 urllib3-1.26.15

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
Installing gfpgan
Traceback (most recent call last):
  File "/Users/alaama/stable-diffusion-webui/launch.py", line 352, in <module>
    prepare_environment()
  File "/Users/alaama/stable-diffusion-webui/launch.py", line 260, in prepare_environment
    run_pip(f"install {gfpgan_package}", "gfpgan")
  File "/Users/alaama/stable-diffusion-webui/launch.py", line 128, 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/alaama/stable-diffusion-webui/launch.py", line 96, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install gfpgan.
Command: "/Users/alaama/stable-diffusion-webui/venv/bin/python3.10" -m pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binary
Error code: 1
stdout: Collecting git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379
  Cloning https://github.com/TencentARC/GFPGAN.git (to revision 8d2447a2d918f8eba5a4a01463fd48e45126a379) to /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-req-build-7o0uibwl
  Resolved https://github.com/TencentARC/GFPGAN.git to commit 8d2447a2d918f8eba5a4a01463fd48e45126a379
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting basicsr>=1.4.2
  Using cached basicsr-1.4.2.tar.gz (172 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting facexlib>=0.2.5
  Using cached facexlib-0.3.0-py3-none-any.whl (59 kB)
Collecting lmdb
  Using cached lmdb-1.4.1.tar.gz (881 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from gfpgan==1.3.5) (1.24.3)
Collecting opencv-python
  Using cached opencv_python-4.7.0.72-cp37-abi3-macosx_11_0_arm64.whl (32.6 MB)
Collecting pyyaml
  Using cached PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl (173 kB)
Collecting scipy
  Using cached scipy-1.10.1.tar.gz (42.4 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 'error'

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-req-build-7o0uibwl
  Running command git rev-parse -q --verify 'sha^8d2447a2d918f8eba5a4a01463fd48e45126a379'
  Running command git fetch -q https://github.com/TencentARC/GFPGAN.git 8d2447a2d918f8eba5a4a01463fd48e45126a379
  Running command git checkout -q 8d2447a2d918f8eba5a4a01463fd48e45126a379
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      The Meson build system
      Version: 1.1.0
      Source dir: /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-install-ouqs9kbk/scipy_63b0e8aaaff04fa4a536ee2db9a33fa5
      Build dir: /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-install-ouqs9kbk/scipy_63b0e8aaaff04fa4a536ee2db9a33fa5/.mesonpy-mds_q3ia/build
      Build type: native build
      Project name: SciPy
      Project version: 1.10.1
      C compiler for the host machine: cc (clang 13.0.0 "Apple clang version 13.0.0 (clang-1300.0.29.3)")
      C linker for the host machine: cc ld64 711
      C++ compiler for the host machine: c++ (clang 13.0.0 "Apple clang version 13.0.0 (clang-1300.0.29.3)")
      C++ linker for the host machine: c++ ld64 711

      ../../meson.build:1:0: ERROR: Cython compiler 'cython' cannot compile programs

      A full log can be found at /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-install-ouqs9kbk/scipy_63b0e8aaaff04fa4a536ee2db9a33fa5/.mesonpy-mds_q3ia/build/meson-logs/meson-log.txt
      + meson setup --prefix=/opt/homebrew/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10 /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-install-ouqs9kbk/scipy_63b0e8aaaff04fa4a536ee2db9a33fa5 /private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-install-ouqs9kbk/scipy_63b0e8aaaff04fa4a536ee2db9a33fa5/.mesonpy-mds_q3ia/build --native-file=/private/var/folders/bc/95kdddld5m35gz2gk74d8kdr0000gn/T/pip-install-ouqs9kbk/scipy_63b0e8aaaff04fa4a536ee2db9a33fa5/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip

Additional information

No response

jakevdp commented 1 year ago

I got a similar error today when trying to pip install scipy on OSX with Python 3.11; I found that upgrading pip to the latest version fixed the issue:

pip install -U pip
imagedubonheur commented 1 year ago

I've tried upgrading pip but it didn't work. Attached is the error I've got.

Screen Shot 2023-05-03 at 9 30 42 PM Screen Shot 2023-05-03 at 9 30 58 PM Screen Shot 2023-05-03 at 9 31 16 PM
jakevdp commented 1 year ago

OK, well it was worth a shot.

barracuda156 commented 9 months ago

Apparently meson having problems with picking environment variables.

py-numpy is broken after moving to meson:

* Building wheel...
+ /opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2/vendored-meson/meson/meson.py setup /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2/.mesonpy-u9s8fn3e/build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --cross-file /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2/.mesonpy-u9s8fn3e/build/meson-python-cross-file.ini --native-file=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2/.mesonpy-u9s8fn3e/build/meson-python-native-file.ini
The Meson build system
Version: 1.2.99
Source dir: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2
Build dir: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-numpy/py311-numpy/work/numpy-1.26.2/.mesonpy-u9s8fn3e/build
Build type: cross build
Project name: NumPy
Project version: 1.26.2
C compiler for the host machine: cc -arch ppc (gcc 4.2.1 "powerpc-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5626)")
C linker for the host machine: cc -arch ppc ld64 87.3.1
C++ compiler for the host machine: c++ -arch ppc (gcc 4.2.1 "powerpc-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5626)")
C++ linker for the host machine: c++ -arch ppc ld64 87.3.1

../../meson.build:1:0: ERROR: Unknown compiler(s): [['cython'], ['cython3']]
The following exception(s) were encountered:
Running `cython -V` gave "[Errno 2] No such file or directory: 'cython'"
Running `cython3 -V` gave "[Errno 2] No such file or directory: 'cython3'"

Picking some nonsense instead of using env vars.