Detectron2: install:/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found

Created on 1 Sep 2020  Â·  10Comments  Â·  Source: facebookresearch/detectron2

If you do not know the root cause of the problem, and wish someone to help you, please
post according to this template:

Instructions To Reproduce the Issue:

Check https://stackoverflow.com/help/minimal-reproducible-example for how to ask good questions.
Simplify the steps to reproduce the issue using suggestions from the above link, and provide them below:

  1. full code you wrote or full changes you made (git diff)
<put code or diff here>
  1. what exact command you run:python -m pip install -e detectron2
  2. __full logs__ you observed:
<put logs here>
ERROR: Command errored out with exit status 1:
 command: /home/cl/anaconda3/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/cl/gitclone/detectron2/setup.py'"'"'; __file__='"'"'/home/cl/gitclone/detectron2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
     cwd: /home/cl/gitclone/detectron2/
Complete output (121 lines):
running develop
running egg_info
writing detectron2.egg-info/PKG-INFO
writing dependency_links to detectron2.egg-info/dependency_links.txt
writing requirements to detectron2.egg-info/requires.txt
writing top-level names to detectron2.egg-info/top_level.txt
reading manifest file 'detectron2.egg-info/SOURCES.txt'
writing manifest file 'detectron2.egg-info/SOURCES.txt'
running build_ext
building 'detectron2._C' extension
creating /home/cl/gitclone/detectron2/build
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/cocoeval
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated
creating /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/deformable
Emitting ninja build file /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/13] :/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o
:/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found
[2/13] :/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cuda.o
:/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found
[3/13] :/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.o
:/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found
[4/13] :/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.o
:/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found
[5/13] c++ -MMD -MF /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.o.d -pthread -B /home/cl/anaconda3/envs/detectron2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
[6/13] c++ -MMD -MF /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.o.d -pthread -B /home/cl/anaconda3/envs/detectron2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.cpp -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
[7/13] c++ -MMD -MF /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o.d -pthread -B /home/cl/anaconda3/envs/detectron2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
[8/13] c++ -MMD -MF /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.o.d -pthread -B /home/cl/anaconda3/envs/detectron2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
[9/13] c++ -MMD -MF /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cpu.o.d -pthread -B /home/cl/anaconda3/envs/detectron2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cpu.cpp -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
[10/13] c++ -MMD -MF /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/vision.o.d -pthread -B /home/cl/anaconda3/envs/detectron2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/cl/gitclone/detectron2/detectron2/layers/csrc -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/TH -I/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda/include -I/home/cl/anaconda3/envs/detectron2/include/python3.7m -c -c /home/cl/gitclone/detectron2/detectron2/layers/csrc/vision.cpp -o /home/cl/gitclone/detectron2/build/temp.linux-x86_64-3.7/home/cl/gitclone/detectron2/detectron2/layers/csrc/vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/ATen/Parallel.h:149:0,
                 from /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
                 from /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
                 from /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
                 from /home/cl/gitclone/detectron2/detectron2/layers/csrc/vision.cpp:3:
/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
 #pragma omp parallel for if ((end - begin) >= grain_size)
 ^
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build
    env=env)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
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 "<string>", line 1, in <module>
  File "/home/cl/gitclone/detectron2/setup.py", line 210, in <module>
    cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/setuptools/__init__.py", line 163, in setup
    return distutils.core.setup(**attrs)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/setuptools/command/develop.py", line 38, in run
    self.install_for_development()
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/setuptools/command/develop.py", line 140, in install_for_development
    self.run_command('build_ext')
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 87, in run
    _build_ext.run(self)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 649, in build_extensions
    build_ext.build_extensions(self)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 478, in unix_wrap_ninja_compile
    with_cuda=with_cuda)
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects
    error_prefix='Error compiling objects for extension')
  File "/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build
    raise RuntimeError(message)
RuntimeError: Error compiling objects for extension
----------------------------------------

ERROR: Can't roll back detectron2; was not uninstalled
ERROR: Command errored out with exit status 1: /home/cl/anaconda3/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/cl/gitclone/detectron2/setup.py'"'"'; __file__='"'"'/home/cl/gitclone/detectron2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

Expected behavior:

If there are no obvious error in "what you observed" provided above,
please tell us the expected behavior.

If you expect the model to converge / work better, note that we do not give suggestions
on how to train a new model.
Only in one of the two conditions we will help with it:
(1) You're unable to reproduce the results in detectron2 model zoo.
(2) It indicates a detectron2 bug.

Environment:

Provide your environment information using the following command:

wget -nc -q https://github.com/facebookresearch/detectron2/raw/master/detectron2/utils/collect_env.py && python collect_env.py

/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found
----------------------  -------------------------------------------------------------------------------------------------------
sys.platform            linux
Python                  3.7.7 (default, May  7 2020, 21:25:33) [GCC 7.3.0]
numpy                   1.19.1
detectron2              failed to import
detectron2._C           failed to import
Compiler                c++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
CUDA compiler           Not found
DETECTRON2_ENV_MODULE   <not set>
PyTorch                 1.6.0 @/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch
PyTorch debug build     False
GPU available           True
GPU 0                   GeForce GTX 1070 (arch=6.1)
CUDA_HOME               :/usr/local/cuda
Pillow                  7.2.0
torchvision             0.7.0 @/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torchvision
torchvision arch flags  /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torchvision/_C.so; cannot find cuobjdump
fvcore                  0.1.1.post20200716
cv2                     4.2.0
----------------------  -------------------------------------------------------------------------------------------------------
PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.5.0 (Git Hash e2ac1fac44c5078ca927cb9b90e1b3066a0b2ed0)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 9.2
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_37,code=compute_37
  - CuDNN 7.6.3
  - Magma 2.5.2
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,

If your issue looks like an installation issue / environment issue,
please first try to solve it with the instructions in
https://detectron2.readthedocs.io/tutorials/install.html#common-installation-issues

installation / environment

Most helpful comment

@YvonneZhao0305
in my ~/.bashrc,the cudaPath is wrote like this:
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
my other projects works well except detectron2,so i change it :
export CUDA_HOME=$CUDA_HOME/usr/local/cuda
then the detectron2 works well

All 10 comments

Please make sure

    from torch.utils.cpp_extension import CUDA_HOME

gives a valid directory.
It's currently not a directory, likely due to a wrong environment variable in your environment.

thank you,and in my ~/.bashrc,cuda path is wrote like this:
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
but,collect_env.py read it as :/usr/local/cuda
i change it to /usr/local/cuda(no :),it seems work when i run python collect_env.py.
now i will build detectron2 agagin

this it the output after i run run python collect_env.py
(detectron2) cl@CL:~/gitclone/detectron2/detectron2/utils$ python collect_env.py


sys.platform linux
Python 3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0]
numpy 1.19.1
detectron2 failed to import
detectron2._C failed to import
Compiler c++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
CUDA compiler Cuda compilation tools, release 9.2, V9.2.148
DETECTRON2_ENV_MODULE
PyTorch 1.6.0 @/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch
PyTorch debug build False
GPU available True
GPU 0 GeForce GTX 1070 (arch=6.1)
CUDA_HOME :/usr/local/cuda
Pillow 7.2.0
torchvision 0.7.0 @/home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torchvision
torchvision arch flags /home/cl/anaconda3/envs/detectron2/lib/python3.7/site-packages/torchvision/_C.so; cannot find cuobjdump
fvcore 0.1.1.post20200716
cv2 4.2.0


PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v1.5.0 (Git Hash e2ac1fac44c5078ca927cb9b90e1b3066a0b2ed0)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 9.2
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_37,code=compute_37
  • CuDNN 7.6.3
  • Magma 2.5.2
  • Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,

however,i got the same error when i build detectron2

Please make sure

    from torch.utils.cpp_extension import CUDA_HOME

gives a valid directory.
It does not according to the logs, so cuda code will not build.

(detectron2) cl@CL:~/gitclone/detectron2$ python
Python 3.7.7 (default, May 7 2020, 21:25:33)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

from torch.utils.cpp_extension import CUDA_HOME
print(CUDA_HOME)
/usr/local/cuda

i have solved it,thanks very much

@CUIcaicai I have met same error ,could you tell me how to solve it?

@YvonneZhao0305
in my ~/.bashrc,the cudaPath is wrote like this:
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
my other projects works well except detectron2,so i change it :
export CUDA_HOME=$CUDA_HOME/usr/local/cuda
then the detectron2 works well

@CUIcaicai
THANKS, referring to your solution, I solve it!!!

@CUIcaicai
Installing collected packages: detectron2
Running setup.py develop for detectron2
Successfully installed detectron2
thank you!
but will making such changes in the .bashrc affect other environments?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cold-Winter picture Cold-Winter  Â·  3Comments

GiovanniPasq picture GiovanniPasq  Â·  3Comments

jinfagang picture jinfagang  Â·  3Comments

danielgordon10 picture danielgordon10  Â·  3Comments

joeythegod picture joeythegod  Â·  4Comments