IDEA-Research / Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything
https://arxiv.org/abs/2401.14159
Apache License 2.0
15.17k stars 1.4k forks source link

GroundingDINO install failed #257

Open JonyTianming opened 1 year ago

JonyTianming commented 1 year ago

Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Startup time: 63.2s (import torch: 1.8s, import gradio: 1.1s, import ldm: 0.6s, other imports: 0.9s, list SD models: 0.3s, load scripts: 4.3s, load SD checkpoint: 4.8s, create ui: 48.8s, gradio launch: 0.3s). Start SAM Processing Installing sd-webui-segment-anything requirement: groundingdino Traceback (most recent call last): File "E:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\dino.py", line 36, in install_goundingdino launch.run_pip( File "E:\stable-diffusion-webui\launch.py", line 128, 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 "E:\stable-diffusion-webui\launch.py", line 96, in run raise RuntimeError(message) RuntimeError: Couldn't install sd-webui-segment-anything requirement: groundingdino. Command: "E:\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install git+https://github.com/IDEA-Research/GroundingDINO --prefer-binary Error code: 1 stdout: Collecting git+https://github.com/IDEA-Research/GroundingDINO Cloning https://github.com/IDEA-Research/GroundingDINO to c:\users\jonyzhang\appdata\local\temp\pip-req-build-bsija7ek Resolved https://github.com/IDEA-Research/GroundingDINO to commit 39b1472457b8264adc8581d354bb1d1956ec7ee7 Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Requirement already satisfied: torch in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (2.0.0+cu118) Requirement already satisfied: torchvision in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (0.15.1+cu118) Requirement already satisfied: transformers in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (4.25.1) Requirement already satisfied: addict in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (2.4.0) Requirement already satisfied: yapf in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (0.33.0) Requirement already satisfied: timm in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (0.6.7) Requirement already satisfied: numpy in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (1.23.5) Requirement already satisfied: opencv-python in e:\stable-diffusion-webui\venv\lib\site-packages (from groundingdino==0.1.0) (4.7.0.72) Collecting supervision==0.6.0 (from groundingdino==0.1.0) Using cached supervision-0.6.0-py3-none-any.whl (31 kB) Collecting pycocotools (from groundingdino==0.1.0) 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 in e:\stable-diffusion-webui\venv\lib\site-packages (from supervision==0.6.0->groundingdino==0.1.0) (3.7.1) Requirement already satisfied: filelock in e:\stable-diffusion-webui\venv\lib\site-packages (from torch->groundingdino==0.1.0) (3.12.0) Requirement already satisfied: typing-extensions in e:\stable-diffusion-webui\venv\lib\site-packages (from torch->groundingdino==0.1.0) (4.5.0) Requirement already satisfied: sympy in e:\stable-diffusion-webui\venv\lib\site-packages (from torch->groundingdino==0.1.0) (1.11.1) Requirement already satisfied: networkx in e:\stable-diffusion-webui\venv\lib\site-packages (from torch->groundingdino==0.1.0) (3.1) Requirement already satisfied: jinja2 in e:\stable-diffusion-webui\venv\lib\site-packages (from torch->groundingdino==0.1.0) (3.1.2) Requirement already satisfied: requests in e:\stable-diffusion-webui\venv\lib\site-packages (from torchvision->groundingdino==0.1.0) (2.30.0) Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from torchvision->groundingdino==0.1.0) (9.4.0) Requirement already satisfied: huggingface-hub<1.0,>=0.10.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from transformers->groundingdino==0.1.0) (0.13.4) Requirement already satisfied: packaging>=20.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from transformers->groundingdino==0.1.0) (23.1) Requirement already satisfied: pyyaml>=5.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from transformers->groundingdino==0.1.0) (6.0) Requirement already satisfied: regex!=2019.12.17 in e:\stable-diffusion-webui\venv\lib\site-packages (from transformers->groundingdino==0.1.0) (2023.3.23) Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from transformers->groundingdino==0.1.0) (0.13.3) Requirement already satisfied: tqdm>=4.27 in e:\stable-diffusion-webui\venv\lib\site-packages (from transformers->groundingdino==0.1.0) (4.65.0) Requirement already satisfied: tomli>=2.0.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from yapf->groundingdino==0.1.0) (2.0.1) Requirement already satisfied: contourpy>=1.0.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->supervision==0.6.0->groundingdino==0.1.0) (1.0.7) Requirement already satisfied: cycler>=0.10 in e:\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->supervision==0.6.0->groundingdino==0.1.0) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->supervision==0.6.0->groundingdino==0.1.0) (4.39.3) Requirement already satisfied: kiwisolver>=1.0.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->supervision==0.6.0->groundingdino==0.1.0) (1.4.4) Requirement already satisfied: pyparsing>=2.3.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->supervision==0.6.0->groundingdino==0.1.0) (3.0.9) Requirement already satisfied: python-dateutil>=2.7 in e:\stable-diffusion-webui\venv\lib\site-packages (from matplotlib->supervision==0.6.0->groundingdino==0.1.0) (2.8.2) Requirement already satisfied: colorama in e:\stable-diffusion-webui\venv\lib\site-packages (from tqdm>=4.27->transformers->groundingdino==0.1.0) (0.4.6) Requirement already satisfied: MarkupSafe>=2.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from jinja2->torch->groundingdino==0.1.0) (2.1.2) Requirement already satisfied: charset-normalizer<4,>=2 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (3.1.0) Requirement already satisfied: idna<4,>=2.5 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (2.10) Requirement already satisfied: urllib3<3,>=1.21.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (1.26.15) Requirement already satisfied: certifi>=2017.4.17 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (2022.12.7) Requirement already satisfied: mpmath>=0.19 in e:\stable-diffusion-webui\venv\lib\site-packages (from sympy->torch->groundingdino==0.1.0) (1.3.0) Requirement already satisfied: six>=1.5 in e:\stable-diffusion-webui\venv\lib\site-packages (from python-dateutil>=2.7->matplotlib->supervision==0.6.0->groundingdino==0.1.0) (1.16.0) Building wheels for collected packages: groundingdino, pycocotools Building wheel for groundingdino (setup.py): started Building wheel for groundingdino (setup.py): finished with status 'error' Running setup.py clean for groundingdino Building wheel for pycocotools (pyproject.toml): started Building wheel for pycocotools (pyproject.toml): finished with status 'error' Failed to build groundingdino pycocotools

stderr: WARNING: Ignoring invalid distribution -equests (e:\stable-diffusion-webui\venv\lib\site-packages) Running command git clone --filter=blob:none --quiet https://github.com/IDEA-Research/GroundingDINO 'C:\Users\JonyZhang\AppData\Local\Temp\pip-req-build-bsija7ek' error: subprocess-exited-with-error

python setup.py bdist_wheel did not run successfully. exit code: 1

[99 lines of output] Building wheel groundingdino-0.1.0 Compiling with CUDA running bdist_wheel E:\stable-diffusion-webui\venv\lib\site-packages\torch\utils\cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend. warnings.warn(msg.format('we could not find ninja.')) running build running build_py creating build creating build\lib.win-amd64-cpython-310 creating build\lib.win-amd64-cpython-310\groundingdino copying groundingdino\version.py -> build\lib.win-amd64-cpython-310\groundingdino copying groundingdino__init.py -> build\lib.win-amd64-cpython-310\groundingdino creating build\lib.win-amd64-cpython-310\groundingdino\config copying groundingdino\config\GroundingDINO_SwinB_cfg.py -> build\lib.win-amd64-cpython-310\groundingdino\config copying groundingdino\config\GroundingDINO_SwinT_OGC.py -> build\lib.win-amd64-cpython-310\groundingdino\config copying groundingdino\config\init.py -> build\lib.win-amd64-cpython-310\groundingdino\config creating build\lib.win-amd64-cpython-310\groundingdino\datasets copying groundingdino\datasets\transforms.py -> build\lib.win-amd64-cpython-310\groundingdino\datasets copying groundingdino\datasets\init.py -> build\lib.win-amd64-cpython-310\groundingdino\datasets creating build\lib.win-amd64-cpython-310\groundingdino\models copying groundingdino\models\registry.py -> build\lib.win-amd64-cpython-310\groundingdino\models copying groundingdino\models\init.py -> build\lib.win-amd64-cpython-310\groundingdino\models creating build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\box_ops.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\get_tokenlizer.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\inference.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\logger.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\misc.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\slconfig.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\slio.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\time_counter.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\utils.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\visualizer.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\vl_utils.py -> build\lib.win-amd64-cpython-310\groundingdino\util copying groundingdino\util\init.py -> build\lib.win-amd64-cpython-310\groundingdino\util creating build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\bertwarper.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\fuse_modules.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\groundingdino.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\ms_deform_attn.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\transformer.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\transformer_vanilla.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\utils.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO copying groundingdino\models\GroundingDINO\init.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO creating build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone copying groundingdino\models\GroundingDINO\backbone\backbone.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone copying groundingdino\models\GroundingDINO\backbone\position_encoding.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone copying groundingdino\models\GroundingDINO\backbone\swin_transformer.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone copying groundingdino\models\GroundingDINO\backbone\init.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone running build_ext E:\stable-diffusion-webui\venv\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] ϵͳҲָļ warnings.warn(f'Error checking compiler version for {compiler}: {error}') Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\JonyZhang\AppData\Local\Temp\pip-req-build-bsija7ek\setup.py", line 192, in setup( File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools\init__.py", line 87, in setup return distutils.core.setup(**attrs) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\core.py", line 177, in setup return run_commands(dist) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\core.py", line 193, in run_commands dist.run_commands() File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\dist.py", line 968, in run_commands self.run_command(cmd) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "E:\stable-diffusion-webui\venv\lib\site-packages\wheel\bdist_wheel.py", line 343, in run self.run_command("build") File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\cmd.py", line 317, in run_command self.distribution.run_command(command) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools\command\build.py", line 24, in run super().run() File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\cmd.py", line 317, in run_command self.distribution.run_command(command) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools\command\build_ext.py", line 79, in run _build_ext.run(self) File "E:\stable-diffusion-webui\venv\lib\site-packages\setuptools_distutils\command\build_ext.py", line 339, in run self.build_extensions() File "E:\stable-diffusion-webui\venv\lib\site-packages\torch\utils\cpp_extension.py", line 499, in build_extensions _check_cuda_version(compiler_name, compiler_version) File "E:\stable-diffusion-webui\venv\lib\site-packages\torch\utils\cpp_extension.py", line 387, in _check_cuda_version raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda)) RuntimeError: The detected CUDA version (12.1) mismatches the version that was used to compile PyTorch (11.8). Please make sure to use the same CUDA versions.

[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for groundingdino 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\JonyZhang\AppData\Local\Temp\pip-build-env-7beuv1mk\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\JonyZhang\AppData\Local\Temp\pip-install-28cshvqh\pycocotools_aaef54667c2d4b91836b452490e20276\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 groundingdino, pycocotools, which is required to install pyproject.toml-based projects

None GroundingDINO install failed. Please submit an issue to https://github.com/IDEA-Research/Grounded-Segment-Anything/issues.

rentainhe commented 1 year ago

Failed to build groundingdino pycocotools

It seems like you should refer to pycocotools windows build tutorial about installing COCO API to solve this issue

LiaoZihZrong commented 1 year ago

please look here: https://github.com/IDEA-Research/Grounded-Segment-Anything/issues/260#issuecomment-1571584063

myPC is 1070 and 3080, both install OK