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.85k stars 1.37k forks source link

RuntimeError: The detected CUDA version (10.1) mismatches the version that was used to compile PyTorch (11.7). Please make sure to use the same CUDA versions. #49

Open stefanjaspers opened 1 year ago

stefanjaspers commented 1 year ago

I'm trying to get Grounded SAM to work locally, but I can't get it to work. Here are the steps I've taken to reproduce the issue:

After doing this, I get the following error output:

Collecting git+https://github.com/IDEA-Research/GroundingDINO.git
  Cloning https://github.com/IDEA-Research/GroundingDINO.git to c:\users\stefan\appdata\local\temp\pip-req-build-rs0jj304
  Running command git clone --filter=blob:none --quiet https://github.com/IDEA-Research/GroundingDINO.git 'C:\Users\Stefan\AppData\Local\Temp\pip-req-build-rs0jj304'
  Resolved https://github.com/IDEA-Research/GroundingDINO.git to commit 9dac4c605b40d87d82bfff5961467556f4d381a9
  Preparing metadata (setup.py) ... done
Requirement already satisfied: torch in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from groundingdino==0.1.0) (2.0.0)
Requirement already satisfied: torchvision in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from groundingdino==0.1.0) (0.15.0)
Collecting transformers
  Using cached transformers-4.27.4-py3-none-any.whl (6.8 MB)
Collecting addict
  Using cached addict-2.4.0-py3-none-any.whl (3.8 kB)
Collecting yapf
  Using cached yapf-0.32.0-py2.py3-none-any.whl (190 kB)
Collecting timm
  Using cached timm-0.6.13-py3-none-any.whl (549 kB)
Requirement already satisfied: numpy in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from groundingdino==0.1.0) (1.23.5)
Collecting opencv-python
  Using cached opencv_python-4.7.0.72-cp37-abi3-win_amd64.whl (38.2 MB)
Collecting supervision==0.4.0
  Using cached supervision-0.4.0-py3-none-any.whl (25 kB)
Collecting pycocotools
  Using cached pycocotools-2.0.6-cp38-cp38-win_amd64.whl
Collecting matplotlib
  Using cached matplotlib-3.7.1-cp38-cp38-win_amd64.whl (7.6 MB)
Collecting huggingface-hub
  Using cached huggingface_hub-0.13.4-py3-none-any.whl (200 kB)
Collecting pyyaml
  Using cached PyYAML-6.0-cp38-cp38-win_amd64.whl (155 kB)
Requirement already satisfied: filelock in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torch->groundingdino==0.1.0) (3.9.0)
Requirement already satisfied: typing-extensions in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torch->groundingdino==0.1.0) (4.4.0)
Requirement already satisfied: sympy in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torch->groundingdino==0.1.0) (1.11.1)
Requirement already satisfied: networkx in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torch->groundingdino==0.1.0) (2.8.4)
Requirement already satisfied: jinja2 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torch->groundingdino==0.1.0) (3.1.2)
Requirement already satisfied: requests in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torchvision->groundingdino==0.1.0) (2.28.1)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from torchvision->groundingdino==0.1.0) (9.4.0)
Collecting packaging>=20.0
  Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting tokenizers!=0.11.3,<0.14,>=0.11.1
  Using cached tokenizers-0.13.3-cp38-cp38-win_amd64.whl (3.5 MB)
Collecting tqdm>=4.27
  Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)
Collecting regex!=2019.12.17
  Using cached regex-2023.3.23-cp38-cp38-win_amd64.whl (267 kB)
Collecting pyparsing>=2.3.1
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 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 kiwisolver>=1.0.1
  Using cached kiwisolver-1.4.4-cp38-cp38-win_amd64.whl (55 kB)
Collecting contourpy>=1.0.1
  Using cached contourpy-1.0.7-cp38-cp38-win_amd64.whl (162 kB)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting importlib-resources>=3.2.0
  Using cached importlib_resources-5.12.0-py3-none-any.whl (36 kB)
Collecting colorama
  Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from jinja2->torch->groundingdino==0.1.0) (2.1.1)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (1.26.15)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from requests->torchvision->groundingdino==0.1.0) (2022.12.7)
Requirement already satisfied: mpmath>=0.19 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from sympy->torch->groundingdino==0.1.0) (1.2.1)
Collecting zipp>=3.1.0
  Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB)
Requirement already satisfied: six>=1.5 in c:\users\stefan\anaconda3\envs\grounded-sam\lib\site-packages (from python-dateutil>=2.7->matplotlib->supervision==0.4.0->groundingdino==0.1.0) (1.16.0)
Building wheels for collected packages: groundingdino
  Building wheel for groundingdino (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [90 lines of output]
      Building wheel groundingdino-0.1.0
      Compiling with CUDA
      running bdist_wheel
      C:\Users\Stefan\anaconda3\envs\grounded-sam\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-38
      creating build\lib.win-amd64-cpython-38\groundingdino
      copying groundingdino\version.py -> build\lib.win-amd64-cpython-38\groundingdino
      copying groundingdino\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino
      creating build\lib.win-amd64-cpython-38\groundingdino\models
      copying groundingdino\models\registry.py -> build\lib.win-amd64-cpython-38\groundingdino\models
      copying groundingdino\models\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\models
      creating build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\box_ops.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\get_tokenlizer.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\inference.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\logger.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\misc.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\slconfig.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\slio.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\time_counter.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\utils.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\visualizer.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\vl_utils.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      creating build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\bertwarper.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\fuse_modules.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\groundingdino.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\ms_deform_attn.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\transformer.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\transformer_vanilla.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\utils.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      creating build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\backbone.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\position_encoding.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\swin_transformer.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      running build_ext
      C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
        warnings.warn(f'Error checking compiler version for {compiler}: {error}')
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Stefan\AppData\Local\Temp\pip-req-build-rs0jj304\setup.py", line 192, in <module>
          setup(
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\wheel\bdist_wheel.py", line 325, in run
          self.run_command("build")
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
          self.run_command(cmd_name)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
          _build_ext.run(self)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
          self.build_extensions()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\torch\utils\cpp_extension.py", line 499, in build_extensions
          _check_cuda_version(compiler_name, compiler_version)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\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 (10.1) mismatches the version that was used to compile
      PyTorch (11.7). 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
  Running setup.py clean for groundingdino
Failed to build groundingdino
Installing collected packages: yapf, tokenizers, addict, zipp, regex, pyyaml, python-dateutil, pyparsing, packaging, opencv-python, kiwisolver, fonttools, cycler, contourpy, colorama, tqdm, importlib-resources, matplotlib, huggingface-hub, transformers, timm, supervision, pycocotools, groundingdino
  Running setup.py install for groundingdino ... error
  error: subprocess-exited-with-error

  × Running setup.py install for groundingdino did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      Building wheel groundingdino-0.1.0
      Compiling with CUDA
      running install
      C:\Users\Stefan\anaconda3\envs\grounded-sam\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
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\groundingdino
      copying groundingdino\version.py -> build\lib.win-amd64-cpython-38\groundingdino
      copying groundingdino\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino
      creating build\lib.win-amd64-cpython-38\groundingdino\models
      copying groundingdino\models\registry.py -> build\lib.win-amd64-cpython-38\groundingdino\models
      copying groundingdino\models\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\models
      creating build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\box_ops.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\get_tokenlizer.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\inference.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\logger.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\misc.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\slconfig.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\slio.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\time_counter.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\utils.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\visualizer.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\vl_utils.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      copying groundingdino\util\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\util
      creating build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\bertwarper.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\fuse_modules.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\groundingdino.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\ms_deform_attn.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\transformer.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\transformer_vanilla.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\utils.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      copying groundingdino\models\GroundingDINO\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO
      creating build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\backbone.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\position_encoding.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\swin_transformer.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      copying groundingdino\models\GroundingDINO\backbone\__init__.py -> build\lib.win-amd64-cpython-38\groundingdino\models\GroundingDINO\backbone
      running build_ext
      C:\Users\Stefan\anaconda3\envs\grounded-sam\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.'))
      C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
        warnings.warn(f'Error checking compiler version for {compiler}: {error}')
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Stefan\AppData\Local\Temp\pip-req-build-rs0jj304\setup.py", line 192, in <module>
          setup(
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\command\install.py", line 68, in run
          return orig.install.run(self)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\command\install.py", line 698, in run
          self.run_command('build')
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
          self.run_command(cmd_name)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
          _build_ext.run(self)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
          self.build_extensions()
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\lib\site-packages\torch\utils\cpp_extension.py", line 499, in build_extensions
          _check_cuda_version(compiler_name, compiler_version)
        File "C:\Users\Stefan\anaconda3\envs\grounded-sam\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 (10.1) mismatches the version that was used to compile
      PyTorch (11.7). 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: legacy-install-failure

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

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

I've set the CUDA_HOME environment variable as the following:

image

The CUDA version mismatch error is pretty clear, but I'm pretty new to Python and Anaconda so I'm not sure how to fix this error. Any advice is welcome!

Single430 commented 1 year ago

@stefanjaspers Hello, how did you solve it?

stefanjaspers commented 1 year ago

@stefanjaspers Hello, how did you solve it?

Hi. The cause of the problem was that I had multiple versions of CUDA installed on my PC, combined with the fact that my system environment variable was targeting CUDA 10.1.

I decided to uninstall all versions of CUDA and downloaded and installed CUDA 1.8. I then created a new system environment variable called “CUDA_HOME” which targets the directory of CUDA 1.8.

After doing this, everything worked fine. I’ll reopen this issue for now. If there’s anything else I can help you with, let me know!

Single430 commented 1 year ago

@stefanjaspers Hello, how did you solve it?

Hi. The cause of the problem was that I had multiple versions of CUDA installed on my PC, combined with the fact that my system environment variable was targeting CUDA 10.1.

I decided to uninstall all versions of CUDA and downloaded and installed CUDA 1.8. I then created a new system environment variable called “CUDA_HOME” which targets the directory of CUDA 1.8.

After doing this, everything worked fine. I’ll reopen this issue for now. If there’s anything else I can help you with, let me know!

Okay, thank you very much for your response. I will try to reinstall from scratch.