%%writefile setup.sh
pip install ninja yacs cython matplotlib tqdm opencv-python cityscapesscripts
pip install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install
cd ../../
rm -rf apex
git clone https://github.com/NVIDIA/apex.git
cd apex
git pull
python setup.py install --cuda_ext --cpp_ext
cd ../
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
cd maskrcnn-benchmark
python setup.py build develop
!sh setup.sh
RuntimeError: Error compiling objects for extension
When I execute the above command, I get an error. why.
running on google colab
I have the same problem. Please let me know if you can solve it. Thank you
is there any updates?
6 errors detected in the compilation of "/tmp/tmpxft_00009924_00000000-6_deform_conv_cuda.cpp1.ii".
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1395, in _run_ninja_build
subprocess.run(
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 59, in
setup(
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 87, in run
_build_ext.run(self)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 580, in build_extensions
build_ext.build_extensions(self)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 414, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1135, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "/home/gerald/miniconda3/envs/maskrcnn_benchmark/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1413, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension
I solved it.
Please check pytorch version, it can may go well.
thank you very much!
hey, I have the same problem but I cant figure out how i can change my pytorch version to the correct version. I have the following Version
Python 3.8.2 (default, May 6 2020, 09:02:42) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
import torch
print(torch.__version__)
1.6.0.dev20200514
and i have the cuda driver 10.2
Can you please help me to solve the problem.
Thanks a lot in advance
i finally chose Detectron2 and the installation (ubuntu20 cuda 10.2 pytorch 1.5stable) is very easy
I have the same problem.
I use:
I tried other versions of Pytorch, Cuda, GCC and Ubuntu. But the error remains.
Can you help me?!
Thanks.
I use :
pytorch 1.4
torchvision 0.5.0
cuda 10.1
I was able to run the program.
i was able to compile it with pytorch 1.4, but fails with teh same error on pytorch 1.5
In my case it worked when using version 0.5.0 of torchvision that comes with pytorch 1.4. In version 1.5 of pytorch the default torchdivion is version 0.6.0.
When using torchdivion 0.6.0 the same error occurs.
The current release works in windows 10 if you have torch==1.4.0 and torchvision ==0.5.0.
Works with PyTorch 1.4.0 and torchvision 0.5.0 for me. Not PyTorch 1.5.1 and torchvision 0.6.1!
Thank you guys!
This works perfectly well.
@HaiyiMei same for me! pyTorch 1.4.0 and torchvision 0.5.0 seems to be the only working version combination with CUDA 10.1
Thanks for answering! I failed when I used torch.__version__=1.8.1 and torchvision.__version__=0.9.x, after I degraded my torch version to 1.5.0 it still failed. Only when I degraded my torch to 1.4.0 and torchvision to 0.5.0(at the same time I degrade my cuda to 10.1), I successfully compile 'python setup.py build develop'
I have torch=1.4.0, torchvision=0.5.0, and cuda=10.1 and I am still getting this error :(
I use:
python 3.8
pytorch '1.7.1.post2'
torchvision 0.10.0a0+730c5e1
Cuda 9
and I am still getting this error :(
Most helpful comment
Thank you guys!
This works perfectly well.