Closed M-Colley closed 1 year ago
Hello, you can try:
python -m pip install -e GroundingDINO
instead of :
cd GroundingDINO
pip install .
Hello and thank you for the quick answer, unfortunately, this did not resolve the issue. I still get the same error.
Kind regards
I'm not sure why this happened, you can double check if your Torch environment is installed correctly
I am not entirely sure why it worked in the end, however, installing the Visual Studio Build Tools and the running
python -m pip install -e GroundingDINO
worked. Thank you.
I also encountered this error on an Ubuntu machine. I solved it with "sudo apt-get install build-essential".
I get the same error with linux (build-essential are installed, torch as well). I'm working from a virtual environment (venv), might it have something to do with that?
Obtaining file:///home/nikste/grounded_sam/GroundingDINO
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... error
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
Traceback (most recent call last):
File "/home/nikste/grounded_sam/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/nikste/grounded_sam/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/nikste/grounded_sam/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 132, in get_requires_for_build_editable
return hook(config_settings)
File "/tmp/pip-build-env-arpnm8ng/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 468, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
File "/tmp/pip-build-env-arpnm8ng/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-arpnm8ng/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-arpnm8ng/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 507, in run_setup
super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-arpnm8ng/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in run_setup
exec(code, locals())
File "<string>", line 27, in <module>
ModuleNotFoundError: No module named 'torch'
[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.
ok, so it seems the issue is that setup.py
form GroundingDINO import torch.
In my case it, for some reason, did not find the module (although installed beforehand).
The canonical way to specify pre installation dependencies in python is using a pyproject.toml
specifying those dependencies.
So, what has worked for me is to add a pyproject.toml
in the root directory of GroundingDINO with the following content:
[build-system]
requires = [
"setuptools",
"torch",
"wheel",
"torch"
]
build-backend = "setuptools.build_meta"
I have done the following
This is the error:
pip show torch
shows that torch is installed:pip show torch Name: torch Version: 2.0.1+cu118
the environment variable
CUDA_HOME
is also set.Any ideas where this comes from?
Kind regards