Repository: stable-diffusion-webui
Issue: [Bug]: Couldn't install requirements for CodeFormer
Labels: bug-report

### Checklist

- [ ] The issue exists after disabling all extensions
- [ ] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [ ] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

Couldn't install requirements for CodeFormer

### Steps to reproduce the problem

Problem occurs upon running ./webui.sh

### What should have happened?

Installed codeformer/requirements for codeformer

### What browsers do you use to access the UI ?

_No response_

### Sysinfo

Apple M1 Mac, Python 3.10.13

### Console logs

```Shell
./webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on ks user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Python 3.10.13 (main, Feb 15 2024, 16:13:56) [Clang 12.0.5 (clang-1205.0.22.11)]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Installing torch and torchvision
Collecting torch==2.0.1
  Using cached torch-2.0.1-cp310-none-macosx_11_0_arm64.whl.metadata (23 kB)
Collecting torchvision==0.15.2
  Using cached torchvision-0.15.2-cp310-cp310-macosx_11_0_arm64.whl.metadata (11 kB)
Collecting filelock (from torch==2.0.1)
  Using cached filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting typing-extensions (from torch==2.0.1)
  Using cached typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Collecting sympy (from torch==2.0.1)
  Using cached sympy-1.12-py3-none-any.whl.metadata (12 kB)
Collecting networkx (from torch==2.0.1)
  Using cached networkx-3.2.1-py3-none-any.whl.metadata (5.2 kB)
Collecting jinja2 (from torch==2.0.1)
  Using cached Jinja2-3.1.3-py3-none-any.whl.metadata (3.3 kB)
Collecting numpy (from torchvision==0.15.2)
  Using cached numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl.metadata (61 kB)
Collecting requests (from torchvision==0.15.2)
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision==0.15.2)
  Using cached pillow-10.2.0-cp310-cp310-macosx_11_0_arm64.whl.metadata (9.7 kB)
Collecting MarkupSafe>=2.0 (from jinja2->torch==2.0.1)
  Using cached MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl.metadata (3.0 kB)
Collecting charset-normalizer<4,>=2 (from requests->torchvision==0.15.2)
  Using cached charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests->torchvision==0.15.2)
  Using cached idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests->torchvision==0.15.2)
  Using cached urllib3-2.2.0-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests->torchvision==0.15.2)
  Using cached certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)
Collecting mpmath>=0.19 (from sympy->torch==2.0.1)
  Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Using cached torch-2.0.1-cp310-none-macosx_11_0_arm64.whl (55.8 MB)
Using cached torchvision-0.15.2-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB)
Using cached pillow-10.2.0-cp310-cp310-macosx_11_0_arm64.whl (3.3 MB)
Using cached filelock-3.13.1-py3-none-any.whl (11 kB)
Using cached Jinja2-3.1.3-py3-none-any.whl (133 kB)
Using cached networkx-3.2.1-py3-none-any.whl (1.6 MB)
Using cached numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl (14.0 MB)
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Using cached sympy-1.12-py3-none-any.whl (5.7 MB)
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)
Using cached charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl (120 kB)
Using cached idna-3.6-py3-none-any.whl (61 kB)
Using cached MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl (18 kB)
Using cached urllib3-2.2.0-py3-none-any.whl (120 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.5 certifi-2024.2.2 charset-normalizer-3.3.2 filelock-3.13.1 idna-3.6 jinja2-3.1.3 mpmath-1.3.0 networkx-3.2.1 numpy-1.26.4 pillow-10.2.0 requests-2.31.0 sympy-1.12 torch-2.0.1 torchvision-0.15.2 typing-extensions-4.9.0 urllib3-2.2.0

[notice] A new release of pip is available: 23.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
Installing clip
Installing open_clip
Installing requirements for CodeFormer
Traceback (most recent call last):
  File "/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/launch.py", line 39, in main
    prepare_environment()
  File "/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/modules/launch_utils.py", line 417, in prepare_environment
    run_pip(f"install -r \"{os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}\"", "requirements for CodeFormer")
  File "/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/modules/launch_utils.py", line 144, 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/ks/Downloads/StableDiffusion/stable-diffusion-webui/modules/launch_utils.py", line 116, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install requirements for CodeFormer.
Command: "/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/venv/bin/python3.10" -m pip install -r "/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt" --prefer-binary
Error code: 1
stdout: Collecting addict (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 1))
  Using cached addict-2.4.0-py3-none-any.whl (3.8 kB)
Collecting future (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 2))
  Using cached future-0.18.3.tar.gz (840 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'
Collecting lmdb (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 3))
  Using cached 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 -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 4)) (1.26.4)
Collecting opencv-python (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 5))
  Using cached opencv_python-4.9.0.80-cp37-abi3-macosx_11_0_arm64.whl.metadata (20 kB)
Requirement already satisfied: Pillow in ./venv/lib/python3.10/site-packages (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 6)) (10.2.0)
Requirement already satisfied: pyyaml in ./venv/lib/python3.10/site-packages (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 7)) (6.0.1)
Requirement already satisfied: requests in ./venv/lib/python3.10/site-packages (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 8)) (2.31.0)
Collecting scikit-image (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 9))
  Using cached scikit_image-0.22.0.tar.gz (22.7 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'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): still running...
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting scipy (from -r /Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/repositories/CodeFormer/requirements.txt (line 10))
  Using cached scipy-1.12.0.tar.gz (56.8 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'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'

stderr:   error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [45 lines of output]
      + meson setup /private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-install-6i_f7g3f/scipy_dcdbeec2738542cd9f2466614323f879 /private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-install-6i_f7g3f/scipy_dcdbeec2738542cd9f2466614323f879/.mesonpy-i0ropr2u -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-install-6i_f7g3f/scipy_dcdbeec2738542cd9f2466614323f879/.mesonpy-i0ropr2u/meson-python-native-file.ini
      The Meson build system
      Version: 1.3.2
      Source dir: /private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-install-6i_f7g3f/scipy_dcdbeec2738542cd9f2466614323f879
      Build dir: /private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-install-6i_f7g3f/scipy_dcdbeec2738542cd9f2466614323f879/.mesonpy-i0ropr2u
      Build type: native build
      Project name: scipy
      Project version: 1.12.0
      C compiler for the host machine: cc (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.11)")
      C linker for the host machine: cc ld64 650.9
      C++ compiler for the host machine: c++ (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.11)")
      C++ linker for the host machine: c++ ld64 650.9
      Cython compiler for the host machine: cython (cython 3.0.8)
      Host machine cpu family: aarch64
      Host machine cpu: aarch64
      Program python found: YES (/Users/ks/Downloads/StableDiffusion/stable-diffusion-webui/venv/bin/python3.10)
      Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 0.29.2
      Run-time dependency python found: YES 3.10
      Program cython found: YES (/private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-build-env-iqz64uww/overlay/bin/cython)
      Compiler for C supports arguments -Wno-unused-but-set-variable: NO
      Compiler for C supports arguments -Wno-unused-function: YES
      Compiler for C supports arguments -Wno-conversion: YES
      Compiler for C supports arguments -Wno-misleading-indentation: YES
      Library m found: YES
      Fortran compiler for the host machine: gfortran (gcc 12.2.0 "GNU Fortran (Homebrew GCC 12.2.0) 12.2.0")
      Fortran linker for the host machine: gfortran ld64 650.9
      Compiler for Fortran supports arguments -Wno-conversion: YES
      Compiler for C supports link arguments -Wl,-ld_classic: NO
      Checking if "-Wl,--version-script" : links: NO
      Program pythran found: YES (/private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-build-env-iqz64uww/overlay/bin/pythran)
      Found CMake: /opt/homebrew/bin/cmake (3.28.3)
      WARNING: CMake Toolchain: Failed to determine CMake compilers state
      Run-time dependency xsimd found: NO (tried pkgconfig, framework and cmake)
      Run-time dependency threads found: YES
      Library npymath found: YES
      Library npyrandom found: YES
      pybind11-config found: YES (/private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-build-env-iqz64uww/overlay/bin/pybind11-config) 2.11.1
      Run-time dependency pybind11 found: YES 2.11.1
      Run-time dependency scipy-openblas found: NO (tried pkgconfig)
      Run-time dependency openblas found: NO (tried pkgconfig, framework and cmake)
      Run-time dependency openblas found: NO (tried pkgconfig, framework and cmake)
      
      ../scipy/meson.build:169:9: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig, framework and cmake
      
      A full log can be found at /private/var/folders/zj/gl2mcg1j35s3ds_pxz8hzkmm0000gn/T/pip-install-6i_f7g3f/scipy_dcdbeec2738542cd9f2466614323f879/.mesonpy-i0ropr2u/meson-logs/meson-log.txt
      [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.
```


### Additional information

_No response_