Skip to content

Installation fails with CUDA 12.4 and PyTorch 2.6.0 during setup #435

Description

@winster-bai

When installing GroundingDINO from source in a conda environment with CUDA 12.4 and PyTorch 2.6.0, the installation fails with errors related to missing pip and torch modules, even though PyTorch is properly installed and CUDA is accessible.

I installed PyTorch using the following command:

pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124
PyTorch environment verification shows everything is working correctly

Is CUDA 12.4 officially supported by GroundingDINO?

`Running setup.py develop for groundingdino
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━ 30/31 [groundingdino] error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [92 lines of output]
    Building wheel groundingdino-0.1.0
    Compiling with CUDA
    running develop
    /home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:90: DevelopDeprecationWarning: develop command is deprecated.
    !!
    
            ********************************************************************************
            Please avoid running ``setup.py`` and ``develop``.
            Instead, use standards-based tools like pip or uv.
    
            By 2025-Oct-31, you need to update your project and remove deprecated calls
            or your builds will no longer be supported.
    
            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************
    
    !!
      self.initialize_options()
    Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
    Obtaining file:///home/dfrobot/GroundingDINO
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Checking if build backend supports build_editable: started
      Checking if build backend supports build_editable: finished with status 'done'
      Getting requirements to build editable: started
      Getting requirements to build editable: finished with status 'error'
      error: subprocess-exited-with-error
    
      × Getting requirements to build editable did not run successfully.
      │ exit code: 1
      ╰─> [29 lines of output]
          /home/dfrobot/anaconda3/envs/groundingdino/bin/python3.10: No module named pip
          Traceback (most recent call last):
            File "<string>", line 32, in install_torch
          ModuleNotFoundError: No module named 'torch'
    
          During handling of the above exception, another exception occurred:
    
          Traceback (most recent call last):
            File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
              main()
            File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
              json_out["return_val"] = hook(**hook_input["kwargs"])
            File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 157, in get_requires_for_build_editable
              return hook(config_settings)
            File "/tmp/pip-build-env-nd48_00q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 473, in get_requires_for_build_editable
              return self.get_requires_for_build_wheel(config_settings)
            File "/tmp/pip-build-env-nd48_00q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
              return self._get_build_requires(config_settings, requirements=[])
            File "/tmp/pip-build-env-nd48_00q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
              self.run_setup()
            File "/tmp/pip-build-env-nd48_00q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 512, in run_setup
              super().run_setup(setup_script=setup_script)
            File "/tmp/pip-build-env-nd48_00q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup
              exec(code, locals())
            File "<string>", line 37, in <module>
            File "<string>", line 34, in install_torch
            File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/subprocess.py", line 369, in check_call
              raise CalledProcessError(retcode, cmd)
          subprocess.CalledProcessError: Command '['/home/dfrobot/anaconda3/envs/groundingdino/bin/python3.10', '-m', 'pip', 'install', 'torch']' returned non-zero exit status 1.
          [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    
    × Getting requirements to build editable did not run successfully.
    │ exit code: 1
    ╰─> See above for output.
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 35, in <module>
      File "/home/dfrobot/GroundingDINO/setup.py", line 204, in <module>
        setup(
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/__init__.py", line 115, in setup
        return distutils.core.setup(**attrs)
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 186, in setup
        return run_commands(dist)
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
        dist.run_commands()
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands
        self.run_command(cmd)
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/dist.py", line 1102, in run_command
        super().run_command(command)
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
        cmd_obj.run()
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/site-packages/setuptools/command/develop.py", line 39, in run
        subprocess.check_call(cmd)
      File "/home/dfrobot/anaconda3/envs/groundingdino/lib/python3.10/subprocess.py", line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/home/dfrobot/anaconda3/envs/groundingdino/bin/python3.10', '-m', 'pip', 'install', '-e', '.', '--use-pep517', '--no-deps']' returned non-zero exit status 1.
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: subprocess-exited-with-error
`
The error seems to occur during the "Getting requirements to build editable" phase, where the setup script attempts to run a subprocess that fails to recognize the existing torch installation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions