【Mac安装stable-diffusion-webui报错解决方案】

Mac安装stable-diffusion-webui报错解决方案

python最好用3.10版本!!!
python最好用3.10版本!!!
python最好用3.10版本!!!

Mac升级Python版本

brew install python@3.10

Mac电脑从stable-diffusion-webui代码库clone后,按照提示运行
bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh) 报错

报错信息汇总:

Installing gfpgan
Traceback (most recent call last):

RuntimeError: Couldn’t install gfpgan.

error: subprocess-exited-with-error
ERROR: Could not find a version that satisfies the requirement cython (from versions: none)
ERROR: No matching distribution found for cython
error: metadata-generation-failed

完整报错如下:

Python 3.10.10 (main, Feb 16 2023, 02:58:25) [Clang 14.0.0 (clang-1400.0.29.202)]
Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2
Installing gfpgan
Traceback (most recent call last):
  File "/Users/xxx/IdeaProjects/stable-diffusion-webui/launch.py", line 380, in <module>
    prepare_environment()
  File "/Users/xxx/IdeaProjects/stable-diffusion-webui/launch.py", line 290, in prepare_environment
    run_pip(f"install {gfpgan_package}", "gfpgan")
  File "/Users/xxx/IdeaProjects/stable-diffusion-webui/launch.py", line 145, in run_pip
    return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
  File "/Users/xxx/IdeaProjects/stable-diffusion-webui/launch.py", line 113, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install gfpgan.
Command: "/usr/local/opt/python@3.10/bin/python3.10" -m pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binary
Error code: 1
stdout: Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379
  Cloning https://github.com/TencentARC/GFPGAN.git (to revision 8d2447a2d918f8eba5a4a01463fd48e45126a379) to /private/var/folders/_m/tjc3x6fd5s5_f6cs_dqt4hx00000gn/T/pip-req-build-2jwucle4
  Resolved https://github.com/TencentARC/GFPGAN.git to commit 8d2447a2d918f8eba5a4a01463fd48e45126a379
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git /private/var/folders/_m/tjc3x6fd5s5_f6cs_dqt4hx00000gn/T/pip-req-build-2jwucle4
  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

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      /usr/local/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
      ERROR: Could not find a version that satisfies the requirement cython (from versions: none)
      ERROR: No matching distribution found for cython
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/local/opt/python@3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_m/tjc3x6fd5s5_f6cs_dqt4hx00000gn/T/tmpq8tsd1vj', '--quiet', 'cython']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/_m/tjc3x6fd5s5_f6cs_dqt4hx00000gn/T/pip-req-build-2jwucle4/setup.py", line 84, in <module>
          setup(
        File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
          _install_setup_requires(attrs)
        File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 85, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 879, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 815, in resolve
          dist = self._resolve_dist(
        File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 851, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1123, in best_match
          return self.obtain(req, installer)
        File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1135, in obtain
          return installer(requirement)
        File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 949, in fetch_build_egg
          return fetch_build_egg(self, req)
        File "/usr/local/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/usr/local/opt/python@3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_m/tjc3x6fd5s5_f6cs_dqt4hx00000gn/T/tmpq8tsd1vj', '--quiet', 'cython']' returned non-zero exit status 1.
      [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 -> 23.0.1
[notice] To update, run: python3.10 -m pip install --upgrade pip

注意看标红的部分,提示阿里云的镜像不是受信任的,把它改成受信任的即可。执行下面的命令

pip config set global.trusted-host mirrors.aliyun.com

PS:如何设置阿里云镜像?执行下面的命令

pip config set global.index-url <http://mirrors.aliyun.com/pypi/simple/>

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
扎眼的阳光的头像扎眼的阳光普通用户
上一篇 2023年12月26日
下一篇 2023年12月26日

相关推荐

此站出售,如需请站内私信或者邮箱!