Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
16.96k stars 1.95k forks source link

[Bug]: Error installing pycocotools after update #749

Closed 2x-y closed 1 year ago

2x-y commented 1 year ago

Is there an existing issue for this?

What happened?

I updated to the latest version and restarted the app. An error occurs during installation of requirements.

Steps to reproduce the problem

  1. Update extentiosn
  2. Restart WebUI

What should have happened?

No error installing requirements.

Commit where the problem happens

webui: commit: 22bcc7be428c94e9408f589966c2040187245d81 checkpoint: 6e8859ee58e9a9c78484b33107e9d22758e1c1f5f72a7ff91ad73a93880b5eef controlnet: 9cd6e5d1 (Sat Apr 15 17:04:21 2023)

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--xformers --vae-path --ckpt --theme dark

Console logs

Error running install.py for extension H:\GitHub\stable-diffusion-webui\extensions\sd-webui-controlnet.
Command: "H:\GitHub\stable-diffusion-webui\venv\Scripts\python.exe" "H:\GitHub\stable-diffusion-webui\extensions\sd-webui-controlnet\install.py"
Error code: 1
stdout: Installing sd-webui-controlnet requirement: pycocotools

stderr: Traceback (most recent call last):
  File "H:\GitHub\stable-diffusion-webui\extensions\sd-webui-controlnet\install.py", line 10, in <module>
    launch.run_pip(f"install {lib}", f"sd-webui-controlnet requirement: {lib}")
  File "H:\GitHub\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 "H:\GitHub\stable-diffusion-webui\launch.py", line 97, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install sd-webui-controlnet requirement: pycocotools.
Command: "H:\GitHub\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install pycocotools --prefer-binary
Error code: 1
stdout: Collecting pycocotools
  Using cached pycocotools-2.0.6.tar.gz (24 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: matplotlib>=2.1.0 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from pycocotools) (3.7.1)
Requirement already satisfied: numpy in h:\github\stable-diffusion-webui\venv\lib\site-packages (from pycocotools) (1.23.3)
Requirement already satisfied: contourpy>=1.0.1 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (1.0.7)
Requirement already satisfied: cycler>=0.10 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (4.39.3)
Requirement already satisfied: kiwisolver>=1.0.1 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (1.4.4)
Requirement already satisfied: packaging>=20.0 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (23.0)
Requirement already satisfied: pillow>=6.2.0 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (9.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (2.8.2)
Requirement already satisfied: six>=1.5 in h:\github\stable-diffusion-webui\venv\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.1.0->pycocotools) (1.16.0)
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (pyproject.toml): started
  Building wheel for pycocotools (pyproject.toml): finished with status 'error'
Failed to build pycocotools

stderr:   error: subprocess-exited-with-error

  Building wheel for pycocotools (pyproject.toml) did not run successfully.
  exit code: 1

  [16 lines of output]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\pycocotools
  copying pycocotools\coco.py -> build\lib.win-amd64-cpython-310\pycocotools
  copying pycocotools\cocoeval.py -> build\lib.win-amd64-cpython-310\pycocotools
  copying pycocotools\mask.py -> build\lib.win-amd64-cpython-310\pycocotools
  copying pycocotools\__init__.py -> build\lib.win-amd64-cpython-310\pycocotools
  running build_ext
  cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
  F:\Temp\pip-build-env-_9ncvhi_\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: F:\Temp\pip-install-j3x6wwvy\pycocotools_36aed39ff31c45078d7299f1793a950b\pycocotools\_mask.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'pycocotools._mask' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

Additional information

Running on Windows.

lllyasviel commented 1 year ago

it seems that pycocotools need complie. let me take a look how to remove the dependency

Shadowghost commented 1 year ago

If it can not be removed here's how to install it on Windows:

  1. Download Build Tools for VS: https://aka.ms/vs/17/release/vs_BuildTools.exe
  2. Install it
  3. Run Visual Studio Installer
  4. Click on Modify for Visual Studio Build Tools 2022
  5. Click on Individual Components
  6. Select and Install these components:
    • Windows Universal C Runtime
    • C++ Build Tools core features
    • MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
    • All Windows SDKs for your Windows version
    • C++ core features
  7. Start a command line in your webui directory
  8. Activate the venv with venv\Scripts\activate
  9. Install Cython pip3 install cython
  10. Install pycocotools via pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" - this is required because installing from pypy is broken on Windows
lllyasviel commented 1 year ago

I am working on removing it by rewriting pycocotools with numpy

lllyasviel commented 1 year ago

fix https://github.com/Mikubill/sd-webui-controlnet/commit/80e76f8f898fa8088bbd33d7fe08d16fd5c1218d completely restart webui to see if this work

2x-y commented 1 year ago

Fixed. Thank you!