ucbdrive / few-shot-object-detection

Implementations of few-shot object detection benchmarks
Apache License 2.0
1.1k stars 223 forks source link

RuntimeError: Error compiling objects for extension #58

Closed 1786939789 closed 3 years ago

1786939789 commented 4 years ago

I have followed the instructions to install the dependencies. But when I build FsDet, there was a RuntimeError: Error compiling objects for extension.

My environment:

Error: Traceback (most recent call last): File "setup.py", line 114, in cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension}, File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/setuptools/init.py", line 144, in setup return distutils.core.setup(**attrs) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 87, in run _build_ext.run(self) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 580, in build_extensions build_ext.build_extensions(self) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 208, in build_extension _build_ext.build_extension(self, ext) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension depends=ext.depends) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 423, in unix_wrap_ninja_compile with_cuda=with_cuda) File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1140, in _write_ninja_file_and_compile_objects error_prefix='Error compiling objects for extension') File "/usr0/home/zhiqic/anaconda3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1413, in _run_ninja_build raise RuntimeError(message) RuntimeError: Error compiling objects for extension

bjditto1221 commented 4 years ago

Had a similar issue. torch.cuda.is_available() returns true even if your pytorch version doesn't support an older gpu. So, removing the code from line 32-41 in setup.py worked for me.

hjraad commented 4 years ago

@thomasehuang : facing the same issue, any idea?

hjraad commented 4 years ago

@bjditto1221 : lines 32-41? or 32 to 46?

xinw1012 commented 3 years ago

Could you try to build the code with CUDA 10.0? There might be some issues with CUDA 10.2. We are working on upgrading the code and remove the detectron2 dependencies. Stay tuned.

hjamalirad commented 3 years ago

I managed to fix it following some hint on the internet regarding cuBLAS. Nonetheless, an upgrade is more than welcome.

bjditto1221 commented 3 years ago

@bjditto1221 : lines 32-41? or 32 to 46?

@hjraad my bad it is 32-46. I should also mention this is just a hack to get it to work with cpu only. if you need it to run on gpu you'll need to try the CUDA changes mentioned above.

xinw1012 commented 3 years ago

The codebase has been upgraded. It should work for CUDA10.2 with Pytorch 1.6 now. The detectron2 version is now upgraded to v0.2.1. Feel free to test the latest release and let us know if anything goes wrong. Thanks!

chengyu0910 commented 3 years ago

@bjditto1221 it work for me too, thanks! cuda: 10.2 pytorch: 1.6.0 python: 3.7.9 gcc: 5.4.0