AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: RuntimeError: Couldn't install gfpgan. #9033

Closed holtm123 closed 1 year ago

holtm123 commented 1 year ago

Is there an existing issue for this?

What happened?

I have already upgraded pip to the latest version, checked the network connection and disabled all firewalls, but I still encounter the following issues.

(The error in the first line of this code block also appears sometimes, and I am not sure why.)

python 3.10.6

Steps to reproduce the problem

1.Install Python 3.10.6 2.Install Git 2.40.0 64bit 3.Type "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git" in the command prompt (cmd) 4.Modify the webui-user file 5.Double-click on webui-user.

What should have happened?

installing successfully

Commit where the problem happens

cmd

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

In webui.bat

@echo off

set PYTHON="C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe"
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=
git pull
call webui.bat

List of extensions

none

Console logs

fatal: unable to access 'https://github.com/AUTOMATIC1111/stable-diffusion-webui.git/': Recv failure: Connection was aborted
venv "C:\Users\admin\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 955df7751eef11bb7697e2d77f6b8a6226b21e13
Installing gfpgan
Traceback (most recent call last):
  File "C:\Users\admin\stable-diffusion-webui\launch.py", line 351, in <module>
    prepare_environment()
  File "C:\Users\admin\stable-diffusion-webui\launch.py", line 259, in prepare_environment
    run_pip(f"install {gfpgan_package}", "gfpgan")
  File "C:\Users\admin\stable-diffusion-webui\launch.py", line 129, 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 "C:\Users\admin\stable-diffusion-webui\launch.py", line 97, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install gfpgan.
Command: "C:\Users\admin\stable-diffusion-webui\venv\Scripts\python.exe" -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 c:\users\admin\appdata\local\temp\pip-req-build-459nimty

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\admin\AppData\Local\Temp\pip-req-build-459nimty'
  fatal: unable to access 'https://github.com/TencentARC/GFPGAN.git/': Failed to connect to github.com port 443 after 21079 ms: Couldn't connect to server
  fatal: could not fetch fa702eeacff13fe8475b0e102a8b8c37602f3963 from promisor remote
  warning: Clone succeeded, but checkout failed.
  You can inspect what was checked out with 'git status'
  and retry with 'git restore --source=HEAD :/'

  error: subprocess-exited-with-error

  git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\admin\AppData\Local\Temp\pip-req-build-459nimty' did not run successfully.
  exit code: 128

  See above for output.

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

git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\admin\AppData\Local\Temp\pip-req-build-459nimty' did not run successfully.
exit code: 128

See above for output.

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

Additional information

No response

web-97 commented 1 year ago

code: 128 Unable to connect to github, a proxy is required

wzgrx commented 1 year ago

Using clash, turn on tun mode

akx commented 1 year ago

This is a problem with your Internet connection, not with this repo.

Failed to connect to github.com port 443 after 21079 ms: Couldn't connect to server

1wuyuxin commented 1 year ago

使用clash,开启tun模式

沒有用

gaotongxue23 commented 1 year ago

I had the same problem. Is it solved?

H3C528 commented 1 year ago

code problem, here use pip to install gfpgan, it should use git "E:\WorkSpace\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binary

cronvel commented 1 year ago

Got the same problem here:

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git /tmp/pip-req-build-x9pe77zr
  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
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-lgk1yvit/numba_2a2c83ce286043bc85023a572f9df866/setup.py", line 51, in <module>
          _guard_py_ver()
        File "/tmp/pip-install-lgk1yvit/numba_2a2c83ce286043bc85023a572f9df866/setup.py", line 48, in _guard_py_ver
          raise RuntimeError(msg.format(cur_py, min_py, max_py))
      RuntimeError: Cannot install on Python version 3.11.2; only versions >=3.7,<3.11 are supported.
      [end of output]

Seems to be related to the python version, but how do I tell the installation script to use python3.10 instead of python3.11.2 ?

Also I'm not a Python programmer, but WTF with the code running on 3.10 but not on 3.11??? I got the same issue with InvokeAI when I upgraded my OS to Fedora37 last week... Have Python coders ever heard of Semantic Versioning (a.k.a. SemVer)? Why on earth a minor version would not be backward compatible???

EDIT: BTW python3.10 is installed on my computer alongside with python3.11.

LeeKIngKIng commented 1 year ago

venv "F:\stable-diffusion\venv\Scripts\Python.exe" Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Commit hash: 22bcc7be428c94e9408f589966c2040187245d81 Installing gfpgan Traceback (most recent call last): File "F:\stable-diffusion\launch.py", line 355, in prepare_environment() File "F:\stable-diffusion\launch.py", line 263, in prepare_environment run_pip(f"install {gfpgan_package}", "gfpgan") File "F:\stable-diffusion\launch.py", line 129, 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 "F:\stable-diffusion\launch.py", line 97, in run raise RuntimeError(message) RuntimeError: Couldn't install gfpgan. Command: "F:\stable-diffusion\venv\Scripts\python.exe" -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 c:\users\administrator\appdata\local\temp\pip-req-build-5u7tuupb

stderr: Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-5u7tuupb' fatal: unable to access 'https://github.com/TencentARC/GFPGAN.git/': Recv failure: Connection was reset error: subprocess-exited-with-error

git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-5u7tuupb' did not run successfully. exit code: 128

See above for output.

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

git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-5u7tuupb' did not run successfully. exit code: 128

See above for output.

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

I have the same problem,what should I do?

LeeKIngKIng commented 1 year ago

I finally solve it!! Just type ipconfig/flushdns in cmd

bluce commented 1 year ago

It work for me! modify launch.py

  1. find out launch.py at root
  2. modify prepare_enviroment()
  3. modify  https://github.com/ to  https://ghproxy.com/https://github.com/

and relaunch webui.bat

eg: https://www.bilibili.com/read/cv19991459?from=search

jbnv commented 1 year ago

I'm running into the same error, but I'm using MacOS on M1. I followed this instruction to install gfpgan:

code problem, here use pip to install gfpgan, it should use git "E:\WorkSpace\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binary

That fails with this output:

(venv) jay@Sidneys-Mini stable-diffusion-webui % pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binary
Collecting git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379
  Cloning https://github.com/TencentARC/GFPGAN.git (to revision 8d2447a2d918f8eba5a4a01463fd48e45126a379) to /private/var/folders/2b/gqynf8fn3jx620944b_7vz480000gn/T/pip-req-build-nxqmvr37
  Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git /private/var/folders/2b/gqynf8fn3jx620944b_7vz480000gn/T/pip-req-build-nxqmvr37
  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
  Resolved https://github.com/TencentARC/GFPGAN.git to commit 8d2447a2d918f8eba5a4a01463fd48e45126a379
  Preparing metadata (setup.py) ... done
Collecting basicsr>=1.4.2
  Using cached basicsr-1.4.2.tar.gz (172 kB)
  Preparing metadata (setup.py) ... done
Collecting facexlib>=0.2.5
  Using cached facexlib-0.2.5-py3-none-any.whl (59 kB)
Collecting lmdb
  Using cached lmdb-1.4.1.tar.gz (881 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from gfpgan==1.3.5) (1.24.2)
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-cp310-cp310-macosx_12_0_arm64.whl (28.8 MB)
Collecting tb-nightly
  Using cached tb_nightly-2.13.0a20230409-py3-none-any.whl (5.6 MB)
Requirement already satisfied: torch>=1.7 in ./venv/lib/python3.10/site-packages (from gfpgan==1.3.5) (1.12.1)
Requirement already satisfied: torchvision in ./venv/lib/python3.10/site-packages (from gfpgan==1.3.5) (0.13.1)
Collecting tqdm
  Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)
Requirement already satisfied: yapf in ./venv/lib/python3.10/site-packages (from gfpgan==1.3.5) (0.32.0)
Collecting addict
  Using cached addict-2.4.0-py3-none-any.whl (3.8 kB)
Collecting future
  Using cached future-0.18.3.tar.gz (840 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Pillow in ./venv/lib/python3.10/site-packages (from basicsr>=1.4.2->gfpgan==1.3.5) (9.5.0)
Requirement already satisfied: requests in ./venv/lib/python3.10/site-packages (from basicsr>=1.4.2->gfpgan==1.3.5) (2.28.2)
Collecting scikit-image
  Using cached scikit_image-0.20.0-cp310-cp310-macosx_12_0_arm64.whl (12.7 MB)
Collecting filterpy
  Using cached filterpy-1.4.5.zip (177 kB)
  Preparing metadata (setup.py) ... done
Collecting numba
  Using cached numba-0.56.4-cp310-cp310-macosx_11_0_arm64.whl (2.4 MB)
Requirement already satisfied: typing-extensions in ./venv/lib/python3.10/site-packages (from torch>=1.7->gfpgan==1.3.5) (4.5.0)
Collecting werkzeug>=1.0.1
  Using cached Werkzeug-2.2.3-py3-none-any.whl (233 kB)
Collecting protobuf>=3.19.6
  Using cached protobuf-4.22.1-cp37-abi3-macosx_10_9_universal2.whl (397 kB)
Collecting absl-py>=0.4
  Using cached absl_py-1.4.0-py3-none-any.whl (126 kB)
Collecting markdown>=2.6.8
  Using cached Markdown-3.4.3-py3-none-any.whl (93 kB)
Collecting grpcio>=1.48.2
  Using cached grpcio-1.53.0-cp310-cp310-macosx_12_0_universal2.whl (8.4 MB)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in ./venv/lib/python3.10/site-packages (from tb-nightly->gfpgan==1.3.5) (1.8.1)
Requirement already satisfied: setuptools>=41.0.0 in ./venv/lib/python3.10/site-packages (from tb-nightly->gfpgan==1.3.5) (67.2.0)
Collecting wheel>=0.26
  Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
Collecting tensorboard-data-server<0.8.0,>=0.7.0
  Using cached tensorboard_data_server-0.7.0-py3-none-any.whl (2.4 kB)
Collecting google-auth-oauthlib<1.1,>=0.5
  Using cached google_auth_oauthlib-1.0.0-py2.py3-none-any.whl (18 kB)
Collecting google-auth<3,>=1.6.3
  Using cached google_auth-2.17.2-py2.py3-none-any.whl (178 kB)
Collecting pyasn1-modules>=0.2.1
  Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting rsa<5,>=3.1.4
  Using cached rsa-4.9-py3-none-any.whl (34 kB)
Collecting six>=1.9.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting cachetools<6.0,>=2.0.0
  Using cached cachetools-5.3.0-py3-none-any.whl (9.3 kB)
Collecting requests-oauthlib>=0.7.0
  Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.10/site-packages (from requests->basicsr>=1.4.2->gfpgan==1.3.5) (1.26.15)
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.10/site-packages (from requests->basicsr>=1.4.2->gfpgan==1.3.5) (3.4)
Requirement already satisfied: charset-normalizer<4,>=2 in ./venv/lib/python3.10/site-packages (from requests->basicsr>=1.4.2->gfpgan==1.3.5) (3.1.0)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.10/site-packages (from requests->basicsr>=1.4.2->gfpgan==1.3.5) (2022.12.7)
Collecting MarkupSafe>=2.1.1
  Using cached MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_universal2.whl (17 kB)
Collecting matplotlib
  Using cached matplotlib-3.7.1-cp310-cp310-macosx_11_0_arm64.whl (7.3 MB)
Collecting llvmlite<0.40,>=0.39.0dev0
  Using cached llvmlite-0.39.1-cp310-cp310-macosx_11_0_arm64.whl (23.1 MB)
Collecting numpy
  Using cached numpy-1.23.5-cp310-cp310-macosx_11_0_arm64.whl (13.4 MB)
Collecting imageio>=2.4.1
  Using cached imageio-2.27.0-py3-none-any.whl (3.4 MB)
Collecting networkx>=2.8
  Using cached networkx-3.1-py3-none-any.whl (2.1 MB)
Collecting packaging>=20.0
  Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting lazy_loader>=0.1
  Using cached lazy_loader-0.2-py3-none-any.whl (8.6 kB)
Collecting PyWavelets>=1.1.1
  Using cached PyWavelets-1.4.1-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB)
Collecting tifffile>=2019.7.26
  Using cached tifffile-2023.3.21-py3-none-any.whl (218 kB)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in ./venv/lib/python3.10/site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tb-nightly->gfpgan==1.3.5) (0.4.8)
Collecting oauthlib>=3.0.0
  Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)
Collecting fonttools>=4.22.0
  Using cached fonttools-4.39.3-py3-none-any.whl (1.0 MB)
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting pyparsing>=2.3.1
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.4.4-cp310-cp310-macosx_11_0_arm64.whl (63 kB)
Collecting contourpy>=1.0.1
  Using cached contourpy-1.0.7-cp310-cp310-macosx_11_0_arm64.whl (229 kB)
Installing collected packages: lmdb, addict, wheel, tqdm, tensorboard-data-server, six, rsa, pyyaml, pyparsing, pyasn1-modules, protobuf, packaging, oauthlib, numpy, networkx, MarkupSafe, markdown, llvmlite, lazy_loader, kiwisolver, grpcio, future, fonttools, cycler, cachetools, absl-py, werkzeug, tifffile, scipy, requests-oauthlib, PyWavelets, python-dateutil, opencv-python, numba, imageio, google-auth, contourpy, scikit-image, matplotlib, google-auth-oauthlib, tb-nightly, filterpy, facexlib, basicsr, gfpgan
  DEPRECATION: lmdb is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for lmdb ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lmdb did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
      patching file lmdb.h
      patching file mdb.c
      py-lmdb: Using CPython extension; override with LMDB_FORCE_CFFI=1.
      running install
      /Users/jay/stable-diffusion-webui/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build/lib.macosx-12-arm64-cpython-310
      creating build/lib.macosx-12-arm64-cpython-310/lmdb
      copying lmdb/cffi.py -> build/lib.macosx-12-arm64-cpython-310/lmdb
      copying lmdb/__init__.py -> build/lib.macosx-12-arm64-cpython-310/lmdb
      copying lmdb/_config.py -> build/lib.macosx-12-arm64-cpython-310/lmdb
      copying lmdb/tool.py -> build/lib.macosx-12-arm64-cpython-310/lmdb
      copying lmdb/__main__.py -> build/lib.macosx-12-arm64-cpython-310/lmdb
      running build_ext
      building 'cpython' extension
      creating build/temp.macosx-12-arm64-cpython-310
      creating build/temp.macosx-12-arm64-cpython-310/build
      creating build/temp.macosx-12-arm64-cpython-310/build/lib
      creating build/temp.macosx-12-arm64-cpython-310/lmdb
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Ilib/py-lmdb -Ibuild/lib -I/Users/jay/stable-diffusion-webui/venv/include -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c build/lib/mdb.c -o build/temp.macosx-12-arm64-cpython-310/build/lib/mdb.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lmdb

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
liyang9331 commented 1 year ago

https://www.bilibili.com/read/cv19991459?from=search

akx commented 1 year ago

Closing since there are workarounds ("use a proxy for GitHub if you're in a restrictive environment") in this thread.