Open rohit901 opened 1 year ago
Hi, it works with CUDA 11.8. My current setup:
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
This is strange then, because your setup seems to be exactly similar to mine, and yet I'm not able to install/compile the package..
have you set the CUDA_HOME environment variable? can you please type the following and tell me what is the output?
echo $CUDA_HOME
Hi,
I just added the following lines to my .bashrc file:
# >>> CUDA post-installation actions >>>
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# <<< CUDA post-installation actions <<<
These are the post-installation actions specified at NVIDIA docs.
About CUDA_HOME variable, this one is imported by torch here, so if your CUDA_HOME variable is empty is a matter of torch-CUDA communication.
To sum up, by adding aforementioned lines to your .bashrc file (and rebooting your computer or reloading terminal) it should work. If not, check torch-CUDA interaction.
PS: find attached a screenshot of my CUDA_HOME env var:
Hi @dankresio, Thank you for your reply and for your involvement with the help.
I'm accessing the PC through SSH and its a remote linux server.
I was also exploring the code where CUDA_HOME variable is being set, and the value of that variable is '/usr'
in my case and not /usr/local/cuda as shown in your screenshot.
nvcc seems to be working just fine for me, so I'm not sure if its any issue with CUDA. Further, I always use GPU in pytorch code and that also works fine. PyTorch was also installed properly, its just the issues with compilation of this specific project.
Attached screenshot of the code output which sets CUDA_HOME
I will try to check if I'm able to find the path for CUDA as obtained by you
Hi! I think that the problem is in your torch versions. Last, try the following:
1) install these trird party libraries (according to your OS, mine is Ubuntu) for CUDA proper functioning 2) create yout conda env with Python 3.10 and activate the env 3) run the following commands: pip install torch pip install torchvision 4) run the following: git clone https://github.com/IDEA-Research/GroundingDINO.git cd GroundingDINO/ pip3 install -q -e .
That should work.
PS: check if your /usr/local
folder contains any "cuda
" folder because sometimes, VM with pre-build images have NVIDIA stuff installed at /opt
. So first check if /usr/local/
contains this folder; otherwise, find the correct path.
Hello, Thank you for your response once again. I was able to install torch properly with my installed CUDA in my university machine. I might not be able to install packages requiring sudo access as I don't have it on the university machines.
I tried the steps which you have mentioned with python 3.10, and 3.11, but it did not work unfortunately.
I had also added the flag -ccbin=/usr/bin/g++
in setup.py file to pass the compiler argument explicitly:
if CUDA_HOME is not None and (torch.cuda.is_available() or "TORCH_CUDA_ARCH_LIST" in os.environ):
print("Compiling with CUDA")
extension = CUDAExtension
sources += source_cuda
define_macros += [("WITH_CUDA", None)]
extra_compile_args["nvcc"] = [
"-ccbin=/usr/bin/g++",
"-DCUDA_HAS_FP16=1",
"-D__CUDA_NO_HALF_OPERATORS__",
"-D__CUDA_NO_HALF_CONVERSIONS__",
"-D__CUDA_NO_HALF2_OPERATORS__",
]
After doing that, I got this new error saying it is not able to find 'thrust/complex.h' file
error: subprocess-exited-with-error
× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [123 lines of output]
Building wheel groundingdino-0.1.0
Compiling with CUDA
running develop
/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` and ``easy_install``.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
easy_install.initialize_options(self)
/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
running egg_info
writing groundingdino.egg-info/PKG-INFO
writing dependency_links to groundingdino.egg-info/dependency_links.txt
writing requirements to groundingdino.egg-info/requires.txt
writing top-level names to groundingdino.egg-info/top_level.txt
reading manifest file 'groundingdino.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'groundingdino.egg-info/SOURCES.txt'
running build_ext
building 'groundingdino._C' extension
Emitting ninja build file /home/rohit.bharadwaj/Documents/Projects/G_DINO/build/temp.linux-x86_64-cpython-311/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] /usr/bin/nvcc -DWITH_CUDA -I/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/TH -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/THC -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/include/python3.11 -c -c /home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu -o /home/rohit.bharadwaj/Documents/Projects/G_DINO/build/temp.linux-x86_64-cpython-311/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -ccbin=/usr/bin/gcc -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
FAILED: /home/rohit.bharadwaj/Documents/Projects/G_DINO/build/temp.linux-x86_64-cpython-311/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.o
/usr/bin/nvcc -DWITH_CUDA -I/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/TH -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/THC -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/include/python3.11 -c -c /home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu -o /home/rohit.bharadwaj/Documents/Projects/G_DINO/build/temp.linux-x86_64-cpython-311/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -ccbin=/usr/bin/gcc -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
In file included from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/util/Half.h:15,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/core/ScalarType.h:5,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/core/StorageImpl.h:4,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/core/Storage.h:3,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/core/TensorImpl.h:8,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/core/GeneratorImpl.h:8,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/ATen/core/Generator.h:22,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/ATen/CPUGeneratorImpl.h:3,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/ATen/Context.h:3,
from /home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/ATen/ATen.h:7,
from /home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_im2col_cuda.cuh:16,
from /home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu:12:
/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/c10/util/complex.h:8:10: fatal error: thrust/complex.h: No such file or directory
8 | #include <thrust/complex.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
[2/2] /usr/bin/nvcc -DWITH_CUDA -I/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/TH -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/lib/python3.11/site-packages/torch/include/THC -I/home/rohit.bharadwaj/.conda/envs/G_DINO2/include/python3.11 -c -c /home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/cuda_version.cu -o /home/rohit.bharadwaj/Documents/Projects/G_DINO/build/temp.linux-x86_64-cpython-311/home/rohit.bharadwaj/Documents/Projects/G_DINO/groundingdino/models/GroundingDINO/csrc/cuda_version.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -ccbin=/usr/bin/gcc -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
ninja: build stopped: subcommand failed.
I think maybe some issues with the CUDA installation in my machine? But it's strange that PyTorch works just fine and I'm able to train models on GPU on these machines. Perhaps its only issues with the compilation...
It would be nice if authors could provide pre-compiled version of this work just like other popular packages and libraries. I might then be able to use it easily.
For now I think I may have to use older CUDA (11.6) and older PyTorch on my machine to get this to work...
Maybe it's the torch problem.... Try this: https://github.com/pytorch/vision/issues/2360
Sorry not this reason, I meet this for “subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.”. But after I modify by ↑, still not working.
My root cause is "nvcc fatal : Could not open output file {tmpdir}", which {tmpdir} is from $TMPDIR, and it's not exists. After some mkdir it works....
And your root cause is "ERROR: No supported gcc/g++ host compiler found.".
thanks for your reply @fenss, I have used the pip package to install this library and now able to use this library. https://github.com/IDEA-Research/GroundingDINO/issues/88
I noticed a similar issue with cuda 11.6 as well, I received the following issue
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] c++ -MMD -MF /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.o.d -pthread -B /home/thor/anaconda3/envs/torch3denv/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/thor/anaconda3/envs/torch3denv/include -I/home/thor/anaconda3/envs/torch3denv/include -fPIC -O2 -isystem /home/thor/anaconda3/envs/torch3denv/include -fPIC -DWITH_CUDA -I/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/TH -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/home/thor/anaconda3/envs/torch3denv/include/python3.9 -c -c /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp -o /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.o
c++ -MMD -MF /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.o.d -pthread -B /home/thor/anaconda3/envs/torch3denv/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/thor/anaconda3/envs/torch3denv/include -I/home/thor/anaconda3/envs/torch3denv/include -fPIC -O2 -isystem /home/thor/anaconda3/envs/torch3denv/include -fPIC -DWITH_CUDA -I/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/TH -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/home/thor/anaconda3/envs/torch3denv/include/python3.9 -c -c /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp -o /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
In file included from /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp:14:
/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/ATen/cuda/CUDAContext.h:10:10: fatal error: cusolverDn.h: No such file or directory
#include <cusolverDn.h>
^~~~~~~~~~~~~~
compilation terminated.
[2/2] /usr/local/cuda-11.6/bin/nvcc -DWITH_CUDA -I/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/TH -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/home/thor/anaconda3/envs/torch3denv/include/python3.9 -c -c /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu -o /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.o
/usr/local/cuda-11.6/bin/nvcc -DWITH_CUDA -I/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/TH -I/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/home/thor/anaconda3/envs/torch3denv/include/python3.9 -c -c /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu -o /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/build/temp.linux-x86_64-cpython-39/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -std=c++14
In file included from /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_im2col_cuda.cuh:17,
from /home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu:12:
/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/include/ATen/cuda/CUDAContext.h:6:10: fatal error: cusparse.h: No such file or directory
#include <cusparse.h>
^~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1900, in _run_ninja_build
subprocess.run(
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/home/thor/IIITDPHD/thesis_2023/world_engine/Grounded-Segment-Anything/GroundingDINO/setup.py", line 200, in <module>
setup(
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/dist.py", line 1208, in run_command
super().run_command(command)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/command/develop.py", line 34, in run
self.install_for_development()
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/command/develop.py", line 114, in install_for_development
self.run_command('build_ext')
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/dist.py", line 1208, in run_command
super().run_command(command)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 843, in build_extensions
build_ext.build_extensions(self)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions
self._build_extensions_serial()
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial
self.build_extension(ext)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
_build_ext.build_extension(self, ext)
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 549, in build_extension
objects = self.compiler.compile(
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 658, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1573, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "/home/thor/anaconda3/envs/torch3denv/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1916, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]
@aradhyamathur I think it has to do with CUDA/compiler installation like gcc/g++ in your machine. Since I don't have sudo access to my machine I just went with pip installation of this library which is already pre-compiled.
I use WSL2 with windows 10. My cuda version is 11.8, and my g++ version is 11.4. It works for me
I have created a brand new Conda environment with
python=3.10
When using CUDA 11.8:and installing the latest PyTorch version
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
The setup process does not work and i get the following error: ERROR: No supported gcc/g++ host compiler found.
snippet:
My GCC version is:
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
and it seems to work properly.I modified extra_compile_args in setup.py
extra_compile_args = {"cxx": [], "nvcc": ["-ccbin", "/usr/bin/gcc"]}
But still it did not help.However using CUDA 11.6 and older PyTorch version:
conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia
seems to work and the setup build is successful. Requesting you to please look into the error and fix it.
I know there is a Google Colab notebook for inference and demo, but I have specific use cases to run this in my own machine where I currently have access and not through Google Colab.