dustysys / ddetailer

340 stars 74 forks source link

Can't install to automatik. #1

Closed Akis-M closed 9 months ago

Akis-M commented 1 year ago

Traceback (most recent call last): File "C:\StableDif\stable-diffusion-webui\modules\scripts.py", line 170, in load_scripts exec(compiled, module.dict) File "C:\StableDif\stable-diffusion-webui\extensions\ddetailer\scripts\ddetailer.py", line 61, in startup() File "C:\StableDif\stable-diffusion-webui\extensions\ddetailer\scripts\ddetailer.py", line 50, in startup run(f'"{python}" -m pip install mmdet', desc=f"Installing mmdet", errdesc=f"Couldn't install mmdet") File "C:\StableDif\stable-diffusion-webui\launch.py", line 34, in run raise RuntimeError(message) RuntimeError: Couldn't install mmdet. Command: "C:\StableDif\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install mmdet Error code: 1 stdout: Collecting mmdet Downloading mmdet-2.25.3-py3-none-any.whl (1.4 MB) ---------------------------------------- 1.4/1.4 MB 3.7 MB/s eta 0:00:00 Collecting terminaltables Using cached terminaltables-3.1.10-py2.py3-none-any.whl (15 kB) Requirement already satisfied: matplotlib in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from mmdet) (3.6.0) Requirement already satisfied: six in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from mmdet) (1.16.0) Collecting pycocotools Downloading 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: numpy in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from mmdet) (1.23.3)Requirement already satisfied: fonttools>=4.22.0 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (4.37.3) Requirement already satisfied: cycler>=0.10 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (0.11.0) Requirement already satisfied: contourpy>=1.0.1 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (1.0.5) Requirement already satisfied: pillow>=6.2.0 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (9.2.0) Requirement already satisfied: pyparsing>=2.2.1 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (3.0.9) Requirement already satisfied: packaging>=20.0 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (21.3) Requirement already satisfied: kiwisolver>=1.0.1 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (1.4.4) Requirement already satisfied: python-dateutil>=2.7 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (2.8.2) 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 C:\Users\wtf\AppData\Local\Temp\pip-build-env-udsl37br\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: C:\Users\wtf\AppData\Local\Temp\pip-install-w_yjsqvm\pycocotools_e0dc3a4c296d4ac9aea44b144c9d5da5\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

dustysys commented 1 year ago

Try installing the 'Visual Studio 2015, 2017, 2019, and 2022' (X64) redistributable from here and see if that fixes it: https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170

dustysys commented 1 year ago

Saw this on another repo as well, if that doesn't work try running this after activating your sd-webui python env: pip install pycocotools-windows

Akis-M commented 1 year ago

@dustysys Installed from the link you sent. Same error.

Installing openmim Installing mmcv-full Installing mmdet Error loading script: ddetailer.py Traceback (most recent call last): File "C:\StableDif\stable-diffusion-webui\modules\scripts.py", line 170, in load_scripts exec(compiled, module.dict) File "C:\StableDif\stable-diffusion-webui\extensions\ddetailer\scripts\ddetailer.py", line 61, in startup() File "C:\StableDif\stable-diffusion-webui\extensions\ddetailer\scripts\ddetailer.py", line 50, in startup run(f'"{python}" -m pip install mmdet', desc=f"Installing mmdet", errdesc=f"Couldn't install mmdet") File "C:\StableDif\stable-diffusion-webui\launch.py", line 34, in run raise RuntimeError(message) RuntimeError: Couldn't install mmdet. Command: "C:\StableDif\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install mmdet Error code: 1 stdout: Collecting mmdet Using cached mmdet-2.25.3-py3-none-any.whl (1.4 MB) Requirement already satisfied: matplotlib in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from mmdet) (3.6.0) Requirement already satisfied: numpy in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from mmdet) (1.23.3) 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: six in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from mmdet) (1.16.0) Collecting terminaltables Using cached terminaltables-3.1.10-py2.py3-none-any.whl (15 kB) Requirement already satisfied: pyparsing>=2.2.1 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (3.0.9) Requirement already satisfied: contourpy>=1.0.1 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (1.0.5) Requirement already satisfied: kiwisolver>=1.0.1 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (1.4.4) Requirement already satisfied: pillow>=6.2.0 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (9.2.0) Requirement already satisfied: cycler>=0.10 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (0.11.0) Requirement already satisfied: python-dateutil>=2.7 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (2.8.2) Requirement already satisfied: packaging>=20.0 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (21.3) Requirement already satisfied: fonttools>=4.22.0 in c:\stabledif\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->mmdet) (4.37.3) 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 C:\Users\wtf\AppData\Local\Temp\pip-build-env-1zz3n77h\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: C:\Users\wtf\AppData\Local\Temp\pip-install-0bw2587a\pycocotools_aa1038f92394483d9fe1a34159634bd7\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

Idk what you mean by "run this after activating your sd-webui python env". Run it where? How?

dustysys commented 1 year ago

I think it may be different depending on how you installed sd-webui (whether you used conda or not). I used the official install instructions, not conda, and this is what I'd do:

  1. Open powershell (or command prompt)
  2. Navigate to your sd-webui folder
  3. run venv\Scripts\activate
  4. run pip install pycocotools-windows
Akis-M commented 1 year ago

@dustysys ERROR: Could not find a version that satisfies the requirement pycocotools-windows (from versions: none) ERROR: No matching distribution found for pycocotools-windows

dustysys commented 1 year ago

Try this:

  1. Install the Visual C++ 2015 build tools from here.
  2. Open powershell (or command prompt)
  3. Navigate to your sd-webui folder
  4. venv\Scripts\activate
  5. pip install Cython
  6. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
Akis-M commented 1 year ago

@dustysys

Thanks for the help but gonna have to pass, 4GB of pre-requisites just to run an extension is a bit too much hassle for me.

dustysys commented 1 year ago

No worries Giganoob23. If anyone else encounters this error and has space/bandwidth to give my most recent suggestion a shot I'd appreciate if you let me know how it goes or provide the error message if it doesn't work. pycocotools is required by mmdet which is required to perform inference/object detection, so I don't think this dependency can be avoided easily and I'd like to nail down a workaround for anyone who sees this issue.

freecoderwaifu commented 1 year ago

I was having the same issues, Cython installed but pip install failed due to missing the VC++ Build tools, though I already had the VC++ Redists. Tried the installer from the link above but it said it was missing local files and clicking on Download from the internet or a similar named option didn't work either.

Fixed it by installing Build Tools for Visual Studio 2022 from here:

https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022

Launched the installer with --layout Drive:\Foldertodownloadto to make an offline installer though it's probably not needed, used the instructions here:

https://gist.github.com/aljbri/d129e07a72f572aec6eaf9680b6d5f59

Initially just installed MSVC v140 VS 2015 by itself from the Individual Components tab but got errors, kept installing whatever seemed to be related because I really don't know what I'm doing lol. Finally got it working and pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" finished without errors.

I'm still not sure which one of all these components in the attached image are the exact ones needed though, just in case someone also has this issue so they can just download the essentials.

tools

kou201 commented 1 year ago

尝试这个:

  1. 从此处安装 Visual C++ 2015 构建工具。
  2. 打开 powershell(或命令提示符)
  3. 导航到您的 sd-webui 文件夹
  4. venv\Scripts\activate
  5. pip install Cython
  6. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\Scripts>pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" Collecting pycocotools Cloning https://github.com/philferriere/cocoapi.git to c:\users\administrator\appdata\local\temp\pip-install-2p78bre9\pycocotools_5f7cb652a8504ef09696de3b9d02bd3c Running command git clone --filter=blob:none --quiet https://github.com/philferriere/cocoapi.git 'C:\Users\Administrator\AppData\Local\Temp\pip-install-2p78bre9\pycocotools_5f7cb652a8504ef09696de3b9d02bd3c' Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad Preparing metadata (setup.py) ... done Building wheels for collected packages: pycocotools Building wheel for pycocotools (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [20 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 building 'pycocotools._mask' extension creating build\temp.win-amd64-cpython-310 creating build\temp.win-amd64-cpython-310\common creating build\temp.win-amd64-cpython-310\Release creating build\temp.win-amd64-cpython-310\Release\pycocotools "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\numpy\core\include -I../common -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-cpython-310\Release../common/maskApi.obj maskApi.c ../common/maskApi.c(8): fatal error C1083: 无法打开包括文件: “math.h”: No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycocotools Running setup.py clean for pycocotools error: subprocess-exited-with-error

× python setup.py clean did not run successfully. │ exit code: 1 ╰─> [12 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\Administrator\AppData\Local\Temp\pip-install-2p78bre9\pycocotools_5f7cb652a8504ef09696de3b9d02bd3c\PythonAPI\setup.py", line 25, in cythonize(ext_modules) File "S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\Cython\Build\Dependencies.py", line 970, in cythonize module_list, module_metadata = create_extension_list( File "S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\Cython\Build\Dependencies.py", line 816, in create_extension_list for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern): File "S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty raise ValueError(error_msg) ValueError: 'pycocotools/_mask.pyx' doesn't match any files [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed cleaning build dir for pycocotools Failed to build pycocotools Installing collected packages: pycocotools Running setup.py install for pycocotools ... error error: subprocess-exited-with-error

× Running setup.py install for pycocotools did not run successfully. │ exit code: 1 ╰─> [11 lines of output] running install S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\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 running build_ext building 'pycocotools._mask' extension "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\numpy\core\include -I../common -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-cpython-310\Release../common/maskApi.obj maskApi.c ../common/maskApi.c(8): fatal error C1083: 无法打开包括文件: “math.h”: No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2 [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. ╰─> pycocotools

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

S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\Scripts>pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" Collecting pycocotools Cloning https://github.com/philferriere/cocoapi.git to c:\users\administrator\appdata\local\temp\pip-install-4zqesg5c\pycocotools_af09a9b41e7a48a6b5737d602c7f7df6 Running command git clone --filter=blob:none --quiet https://github.com/philferriere/cocoapi.git 'C:\Users\Administrator\AppData\Local\Temp\pip-install-4zqesg5c\pycocotools_af09a9b41e7a48a6b5737d602c7f7df6' Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad Preparing metadata (setup.py) ... done Building wheels for collected packages: pycocotools Building wheel for pycocotools (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [20 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 building 'pycocotools._mask' extension creating build\temp.win-amd64-cpython-310 creating build\temp.win-amd64-cpython-310\common creating build\temp.win-amd64-cpython-310\Release creating build\temp.win-amd64-cpython-310\Release\pycocotools "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\numpy\core\include -I../common -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-cpython-310\Release../common/maskApi.obj maskApi.c ../common/maskApi.c(8): fatal error C1083: 无法打开包括文件: “math.h”: No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycocotools Running setup.py clean for pycocotools error: subprocess-exited-with-error

× python setup.py clean did not run successfully. │ exit code: 1 ╰─> [12 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\Administrator\AppData\Local\Temp\pip-install-4zqesg5c\pycocotools_af09a9b41e7a48a6b5737d602c7f7df6\PythonAPI\setup.py", line 25, in cythonize(ext_modules) File "S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\Cython\Build\Dependencies.py", line 970, in cythonize module_list, module_metadata = create_extension_list( File "S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\Cython\Build\Dependencies.py", line 816, in create_extension_list for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern): File "S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty raise ValueError(error_msg) ValueError: 'pycocotools/_mask.pyx' doesn't match any files [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed cleaning build dir for pycocotools Failed to build pycocotools Installing collected packages: pycocotools Running setup.py install for pycocotools ... error error: subprocess-exited-with-error

× Running setup.py install for pycocotools did not run successfully. │ exit code: 1 ╰─> [11 lines of output] running install S:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\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 running build_ext building 'pycocotools._mask' extension "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\lib\site-packages\numpy\core\include -I../common -IS:\Koikatsu\NoMust\novelai\novelai-webui-10-9update\venv\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\include -IC:\Users\Administrator\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-cpython-310\Release../common/maskApi.obj maskApi.c ../common/maskApi.c(8): fatal error C1083: 无法打开包括文件: “math.h”: No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2 [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. ╰─> pycocotools

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

Strange errors.

dustysys commented 1 year ago

Thanks for digging into this, freecoderwaifu, glad you were able to get it working. That is a lot of stuff to download so I'd like to try and prune it down to what could potentially be required. I would think it would be just the C++ build tool packages but kou201's error comes up in a stackoverflow question which was resolved by installing the 'Desktop development with C++' workload in the same VS build tools installer, which includes both latest MSVC build tools as well as the Windows SDK, so let's try that.

For kou201 (or the next person who runs into the issue) please try these updated instructions:

  1. Download 'Build Tools for Visual Studio 2022' from here.
  2. Run the installer and select 'Desktop development with C++' before installing. This will auto-select the latest packages. Finish installing. image
  3. Open powershell (or command prompt)
  4. Navigate to your sd-webui folder and run these commands:
  5. venv\Scripts\activate
  6. pip install Cython
  7. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
kou201 commented 1 year ago

Thanks for digging into this, freecoderwaifu, glad you were able to get it working. That is a lot of stuff to download so I'd like to try and prune it down to what could potentially be required. I would think it would be just the C++ build tool packages but kou201's error comes up in a stackoverflow question which was resolved by installing the 'Desktop development with C++' workload in the same VS build tools installer, which includes both latest MSVC build tools as well as the Windows SDK, so let's try that.

For kou201 (or the next person who runs into the issue) please try these updated instructions:

  1. Download 'Build Tools for Visual Studio 2022' from here.
  2. Run the installer and select 'Desktop development with C++' before installing. This will auto-select the latest packages. Finish installing. image
  3. Open powershell (or command prompt)
  4. Navigate to your sd-webui folder and run these commands:
  5. venv\Scripts\activate
  6. pip install Cython
  7. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

image

Another problem seems to have arisen. Is this a Python problem?

Dr4g00n92 commented 1 year ago

Thanks for digging into this, freecoderwaifu, glad you were able to get it working. That is a lot of stuff to download so I'd like to try and prune it down to what could potentially be required. I would think it would be just the C++ build tool packages but kou201's error comes up in a stackoverflow question which was resolved by installing the 'Desktop development with C++' workload in the same VS build tools installer, which includes both latest MSVC build tools as well as the Windows SDK, so let's try that. For kou201 (or the next person who runs into the issue) please try these updated instructions:

  1. Download 'Build Tools for Visual Studio 2022' from here.
  2. Run the installer and select 'Desktop development with C++' before installing. This will auto-select the latest packages. Finish installing. image
  3. Open powershell (or command prompt)
  4. Navigate to your sd-webui folder and run these commands:
  5. venv\Scripts\activate
  6. pip install Cython
  7. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

image

Another problem seems to have arisen. Is this a Python problem?

it worked anyways for me, i even uninstalled the Desktop development with C++ and Build Tools for Visual Studio 2022 afterwards.

StewieGriffin commented 1 year ago

I get a different error

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

thenolifer commented 1 year ago

Thanks for digging into this, freecoderwaifu, glad you were able to get it working. That is a lot of stuff to download so I'd like to try and prune it down to what could potentially be required. I would think it would be just the C++ build tool packages but kou201's error comes up in a stackoverflow question which was resolved by installing the 'Desktop development with C++' workload in the same VS build tools installer, which includes both latest MSVC build tools as well as the Windows SDK, so let's try that. For kou201 (or the next person who runs into the issue) please try these updated instructions:

  1. Download 'Build Tools for Visual Studio 2022' from here.
  2. Run the installer and select 'Desktop development with C++' before installing. This will auto-select the latest packages. Finish installing. image
  3. Open powershell (or command prompt)
  4. Navigate to your sd-webui folder and run these commands:
  5. venv\Scripts\activate
  6. pip install Cython
  7. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

image

Another problem seems to have arisen. Is this a Python problem?

I get the same error.

TwistedFromArma commented 1 year ago

same error. pity the extension looks decent but these ms dependencies make the process getting it working just cancer.

dustysys commented 1 year ago

I was able to reproduce this error by renaming my numpy directories so they could not be found. I am not sure how numpy would not be installed given all the places the webui seems to need it. Can someone please do this and post the output:

  1. Navigate to your sd-webui folder and run these commands:
  2. venv\Scripts\activate
  3. pip show numpy
  4. pip show tb-nightly
StewieGriffin commented 1 year ago

I was able to reproduce this error by renaming my numpy directories so they could not be found. I am not sure how numpy would not be installed given all the places the webui seems to need it. Can someone please do this and post the output:

1. Navigate to your sd-webui folder and run these commands:

2. `venv\Scripts\activate`

3. `pip show numpy`

4. `pip show tb-nightly`

pip show numpy

Name: numpy Version: 1.23.3 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. Author-email: License: BSD Location: c:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages Requires: Required-by: accelerate, basicsr, clean-fid, contourpy, deepdanbooru, diffusers, facexlib, fairscale, filterpy, gfpgan, gradio, h5py, imageio, Keras-Preprocessing, lpips, matplotlib, mmcv-full, moviepy, numba, opencv-python, opt-einsum, pandas, pytorch-lightning, PyWavelets, realesrgan, scikit-image, scikit-learn, scipy, seaborn, tb-nightly, tensorboard, tensorflow, tifffile, torchmetrics, torchvision, transformers, xformers

(venv) PS C:\stable-diffusion\stable-diffusion-webui> pip show tb-nightly

Name: tb-nightly Version: 2.11.0a20220924 Summary: TensorBoard lets you watch Tensors Flow Home-page: https://github.com/tensorflow/tensorboard Author: Google Inc. Author-email: packages@tensorflow.org License: Apache 2.0 Location: c:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages Requires: absl-py, google-auth, google-auth-oauthlib, grpcio, markdown, numpy, protobuf, requests, setuptools, tensorboard-data-server, tensorboard-plugin-wit, werkzeug, wheel Required-by: basicsr, gfpgan (venv) PS C:\stable-diffusion\stable-diffusion-webui>

dustysys commented 1 year ago

@StewieGriffin Thanks. To confirm do you get the "ModuleNotFoundError: No module named 'numpy'" portion of the error?

StewieGriffin commented 1 year ago

@dustysys I did, but I manually installed numpy and the error went away

Now I have other error

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

dustysys commented 1 year ago

That error doesn't give much to go on if there are no other packages mentioned. What doesn't make sense before that is that numpy would have not been installed if tb-nightly, which requires numpy, was. That to me suggests some kind of scope issue. If someone is still getting the numpy error please run the commands above to confirm.

4lt3r3go commented 1 year ago

i installed more than 10gb of visual bs and stuff around and this is still doesnt working. Got all errors mentioned above from all of you -.-

dustysys commented 1 year ago

For anyone still encountering the issue, I will need your most recent error log and the full output of these commands to try and help as I cannot reproduce it myself.

hoblin commented 1 year ago

Same problem. I have Visual Studio build tools 2022 installed. Extension shows the same error log. If I'm trying to install it using Cython I have the following exception:

(venv) C:\stable-diffusion-webui>pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
Collecting pycocotools
  Cloning https://github.com/philferriere/cocoapi.git to c:\users\me\appdata\local\temp\pip-install-p5pq2l33\pycocotools_b60876815c25492cba6fd6fdfb78b7d1
  Running command git clone --filter=blob:none --quiet https://github.com/philferriere/cocoapi.git 'C:\Users\me\AppData\Local\Temp\pip-install-p5pq2l33\pycocotools_b60876815c25492cba6fd6fdfb78b7d1'
  Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [13 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
      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
  Running setup.py clean for pycocotools
  error: subprocess-exited-with-error

  × python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\me\AppData\Local\Temp\pip-install-p5pq2l33\pycocotools_b60876815c25492cba6fd6fdfb78b7d1\PythonAPI\setup.py", line 25, in <module>
          cythonize(ext_modules)
        File "C:\stable-diffusion-webui\venv\lib\site-packages\Cython\Build\Dependencies.py", line 970, in cythonize
          module_list, module_metadata = create_extension_list(
        File "C:\stable-diffusion-webui\venv\lib\site-packages\Cython\Build\Dependencies.py", line 816, in create_extension_list
          for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
        File "C:\stable-diffusion-webui\venv\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty
          raise ValueError(error_msg)
      ValueError: 'pycocotools/_mask.pyx' doesn't match any files
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
  Running setup.py install for pycocotools ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pycocotools did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      running install
      C:\stable-diffusion-webui\venv\lib\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
      running build_ext
      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: legacy-install-failure

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

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

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

For anyone still encountering the issue, I will need your most recent error log and the full output of these commands to try and help as I cannot reproduce it myself.

(venv) C:\stable-diffusion-webui>pip show numpy
Name: numpy
Version: 1.23.3
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
License: BSD
Location: c:\stable-diffusion-webui\venv\lib\site-packages
Requires:
Required-by: accelerate, basicsr, blis, clean-fid, contourpy, diffusers, facexlib, fairscale, filterpy, gfpgan, gradio, imageio, lpips, matplotlib, mmcv-full, moviepy, numba, opencv-python, pandas, pytorch-lightning, PyWavelets, realesrgan, scikit-image, scipy, seaborn, spacy, tb-nightly, tensorboard, thinc, tifffile, torchmetrics, torchsde, torchvision, transformers

(venv) C:\stable-diffusion-webui>pip show tb-nightly
Name: tb-nightly
Version: 2.12.0a20221202
Summary: TensorBoard lets you watch Tensors Flow
Home-page: https://github.com/tensorflow/tensorboard
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: c:\stable-diffusion-webui\venv\lib\site-packages
Requires: absl-py, google-auth, google-auth-oauthlib, grpcio, markdown, numpy, protobuf, requests, setuptools, tensorboard-data-server, tensorboard-plugin-wit, werkzeug, wheel
Required-by: basicsr, gfpgan
hoblin commented 1 year ago

OK, just installed it successfully. The requirement is not just a build tools but a Visual Studio community edition.

monydochev commented 1 year ago

Thanks for digging into this, freecoderwaifu, glad you were able to get it working. That is a lot of stuff to download so I'd like to try and prune it down to what could potentially be required. I would think it would be just the C++ build tool packages but kou201's error comes up in a stackoverflow question which was resolved by installing the 'Desktop development with C++' workload in the same VS build tools installer, which includes both latest MSVC build tools as well as the Windows SDK, so let's try that.

For kou201 (or the next person who runs into the issue) please try these updated instructions:

  1. Download 'Build Tools for Visual Studio 2022' from here.
  2. Run the installer and select 'Desktop development with C++' before installing. This will auto-select the latest packages. Finish installing. image
  3. Open powershell (or command prompt)
  4. Navigate to your sd-webui folder and run these commands:
  5. venv\Scripts\activate
  6. pip install Cython
  7. pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

For me,this fix problem and now everything work! Thank you

soysanti commented 1 year ago

image venv\Scripts\activate pip install Cython pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" fix problem Thanks!

treksis commented 1 year ago

make sure you you follow this. soysanti did good job

image

mitsu-star commented 1 year ago

Was using it Peacefully with Google colab now am getting errors

LINGGGGGGGGGG commented 1 year ago

图像 venv\Scripts\activate pip install Cython pip install "git+ https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI " 修复问题 谢谢!

Thanks, win10 must be selected according to the picture, very useful

applesugarai commented 1 year ago

image venv\Scripts\activate pip install Cython pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI" fix problem Thanks!

Thank you so much for the fix!

matrix4767 commented 1 year ago

Hello. I got the same errors here, but when doing the last step of the fix, i get these errors now: WARNING: Ignoring invalid distribution -radio (g:\stable-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -radio (g:\stable-webui\venv\lib\site-packages) Collecting pycocotools Cloning https://github.com/philferriere/cocoapi.git to c:\users\vladivostok\appdata\local\temp\pip-install-wxoqjyuy\pycocotools_a22f038d9c1e476db06990abb1cd8b6a Running command git clone --filter=blob:none --quiet https://github.com/philferriere/cocoapi.git 'C:\Users\Vladivostok\AppData\Local\Temp\pip-install-wxoqjyuy\pycocotools_a22f038d9c1e476db06990abb1cd8b6a' Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad Preparing metadata (setup.py) ... done Building wheels for collected packages: pycocotools Building wheel for pycocotools (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [13 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 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 Running setup.py clean for pycocotools error: subprocess-exited-with-error

× python setup.py clean did not run successfully. │ exit code: 1 ╰─> [12 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\Vladivostok\AppData\Local\Temp\pip-install-wxoqjyuy\pycocotools_a22f038d9c1e476db06990abb1cd8b6a\PythonAPI\setup.py", line 25, in cythonize(ext_modules) File "G:\stable-webui\venv\lib\site-packages\Cython\Build\Dependencies.py", line 973, in cythonize module_list, module_metadata = create_extension_list( File "G:\stable-webui\venv\lib\site-packages\Cython\Build\Dependencies.py", line 816, in create_extension_list for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern): File "G:\stable-webui\venv\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty raise ValueError(error_msg) ValueError: 'pycocotools/_mask.pyx' doesn't match any files [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed cleaning build dir for pycocotools Failed to build pycocotools WARNING: Ignoring invalid distribution -radio (g:\stable-webui\venv\lib\site-packages) Installing collected packages: pycocotools Running setup.py install for pycocotools ... error error: subprocess-exited-with-error

× Running setup.py install for pycocotools did not run successfully. │ exit code: 1 ╰─> [8 lines of output] running install G:\stable-webui\venv\lib\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 running build_ext 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: legacy-install-failure

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

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

FutonGama commented 1 year ago

image venv\Scripts\activate pip install Cython pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

Worked for me and i'm using Windows 11 so i selected Windows 11