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
14.88k stars 1.38k forks source link

Building editable for groundingdino (pyproject.toml) ... error #400

Closed crapthings closed 10 months ago

crapthings commented 10 months ago
Building wheels for collected packages: groundingdino
  Building editable for groundingdino (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for groundingdino (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [128 lines of output]
      /tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
        device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
      Building wheel groundingdino-0.1.0
      Compiling with CUDA
      running editable_wheel
      creating /tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info
      writing /tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/requires.txt
      writing top-level names to /tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/SOURCES.txt'
      /tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py:502: 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.'))
      reading manifest file '/tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino-0.1.0.dist-info'
      creating /tmp/pip-wheel-5nkpauwc/.tmp-27i6j1_a/groundingdino-0.1.0.dist-info/WHEEL
      running build_py
      running build_ext
      Traceback (most recent call last):
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 156, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 345, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 268, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 295, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 525, in build_extensions
          _check_cuda_version(compiler_name, compiler_version)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 413, in _check_cuda_version
          raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
      RuntimeError:
      The detected CUDA version (11.8) mismatches the version that was used to compile
      PyTorch (12.1). Please make sure to use the same CUDA versions.

      /tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py:988: _DebuggingTips: Problem in editable installation.
      !!

              ********************************************************************************
              An error happened while installing `groundingdino` in editable mode.

              The following steps are recommended to help debug this problem:

              - Try to install the project normally, without using the editable mode.
                Does the error still persist?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.

              After following the steps above, if the problem still persists and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:

                  https://github.com/pypa/setuptools/issues

              See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
              ********************************************************************************

      !!
        cmd_obj.run()
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 273, in build_editable
          return hook(wheel_directory, config_settings, metadata_directory)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 436, in build_editable
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 389, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 200, in <module>
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 156, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 345, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 268, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/editable_wheel.py", line 295, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 525, in build_extensions
          _check_cuda_version(compiler_name, compiler_version)
        File "/tmp/pip-build-env-ngff_dns/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 413, in _check_cuda_version
          raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
      RuntimeError:
      The detected CUDA version (11.8) mismatches the version that was used to compile
      PyTorch (12.1). 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 editable for groundingdino
Failed to build groundingdino
ERROR: Could not build wheels for groundingdino, which is required to install pyproject.toml-based projects
root@ca3378b06353:/workspace/Grounded-Segment-Anything# 
crapthings commented 10 months ago

https://github.com/IDEA-Research/Grounded-Segment-Anything/issues/396

yxchng commented 10 months ago

@crapthings how do you resolve this problem?