Detectron2: nvcc.exe failed with exit status 1: Problem installing detectron2 on Windows 10

Created on 15 Jun 2020  路  3Comments  路  Source: facebookresearch/detectron2

Hello everybody,
i would appreciate very much your help on the following problem with installing detectron2 on windows 10.

I am getting a nvcc error after trying to build detectron2 with torch 1.5.0 and torchvision 0.6.0, built on cuda 10.2. I am running the command python -m pip install git+https://github.com/facebookresearch/detectron2.git and getting this error message:

__5 errors detected in the compilation of "C:/Users/lotha/AppData/Local/Temp/tmpxft_000016c8_00000000-10_nms_rotated_cuda.cpp1.ii".
nms_rotated_cuda.cu
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe' failed with exit status 1
Error in atexit.run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\lotha\Anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
ERROR: Failed building wheel for detectron2_

  • OS: Windows 10
  • CUDA version: 10.2
  • python version: 3.7
  • pytorch version: 1.5.0, torchvision 0.6.0
  • gcc/ g++ 9.3.0 (minGW)
  • VS build tools 19
  • torch.__config__.show():
    PyTorch built with:
    - C++ Version: 199711
    - MSVC 191627039
    - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191125 for Intel(R) 64 bit
    - Intel(R) MKL-DNN v0.21.1 (Git Hash 7d2fd500bc78936d1d648ca713b901012f470dbc)
    - OpenMP 200203
    - CPU capability usage: AVX2
    - CUDA Runtime 10.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_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
    - CuDNN 7.6.4 (built against CUDA 10.1)
    - Magma 2.5.2
    - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS=/DWIN32 /D_WINDOWS
    /GR /w /EHa /bigobj -openmp -DNDEBUG -DUSE_FBGEMM, 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=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,

I already tried another cuda-version (9.2), i tried VS 17 build tools, did a conda install for pytorch/ torchvision, tried to build from source code and even set back my computer to ensure that the system variables are at default. On the install.md-troubleshooting of detectron2 there is mentioned that nvcc-errors might be due to a gcc-incompatibility - but i already tried with gcc 9.2.0 and 7.4.0.
Beyond, I think its important to mention that detectron2 already worked on my computer - i just uninstalled it. Below is some part of the log... Thank you very much!

_C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\ATen/Context.h(131): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\ATen/Context.h(132): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\ATen/Context.h(133): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\ATen/TensorGeometry.h(56): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\ATen/TensorGeometry.h(57): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\c10/cuda/CUDAStream.h(171): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\TH/THAllocator.h(60): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\TH/THAllocator.h(66): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/Anaconda3/lib/site-packages/torch/include\THC/THCAllocator.h(14): warning: field of class type without a DLL interface used in a class with a DLL interface

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(14): error: name must be a namespace name

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): error: identifier "single_box_iou_rotated" is undefined
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=double]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): error: type name is not allowed
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=double]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): warning: expression has no effect
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=double]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(58): warning: variable "cur_box" was set but never used
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=double]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): error: identifier "single_box_iou_rotated" is undefined
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=float]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): error: type name is not allowed
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=float]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): warning: expression has no effect
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=float]"
(105): here

C:/Users/lotha/AppData/Local/Temp/pip-req-build-fb0oenry/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(58): warning: variable "cur_box" was set but never used
detected during instantiation of "void nms_rotated_cuda_kernel(int, float, const T *, unsigned long long *) [with T=float]"
(105): here

installation / environment

Most helpful comment

I ran into the same issue, in my case the "box_iou_rotated_utils.h" wasn't being imported properly in the detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu file.

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAApplyUtils.cuh>
//NOTE: replace relative import
/*#ifdef WITH_CUDA
#include "../box_iou_rotated/box_iou_rotated_utils.h"
#endif
// TODO avoid this when pytorch supports "same directory" hipification
#ifdef WITH_HIP
#include "box_iou_rotated/box_iou_rotated_utils.h"
#endif*/
#include "box_iou_rotated/box_iou_rotated_utils.h"

I guess the relative import wasn't working on windows. So I commented out the WITH_CUDA and WITH_HIP checks and instead just used #include "box_iou_rotated/box_iou_rotated_utils.h"

All 3 comments

Unfortunately we do not provide support for windows.

I ran into the same issue, in my case the "box_iou_rotated_utils.h" wasn't being imported properly in the detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu file.

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAApplyUtils.cuh>
//NOTE: replace relative import
/*#ifdef WITH_CUDA
#include "../box_iou_rotated/box_iou_rotated_utils.h"
#endif
// TODO avoid this when pytorch supports "same directory" hipification
#ifdef WITH_HIP
#include "box_iou_rotated/box_iou_rotated_utils.h"
#endif*/
#include "box_iou_rotated/box_iou_rotated_utils.h"

I guess the relative import wasn't working on windows. So I commented out the WITH_CUDA and WITH_HIP checks and instead just used #include "box_iou_rotated/box_iou_rotated_utils.h"

I ran into the same issue, in my case the "box_iou_rotated_utils.h" wasn't being imported properly in the detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu file.

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAApplyUtils.cuh>
//NOTE: replace relative import
/*#ifdef WITH_CUDA
#include "../box_iou_rotated/box_iou_rotated_utils.h"
#endif
// TODO avoid this when pytorch supports "same directory" hipification
#ifdef WITH_HIP
#include "box_iou_rotated/box_iou_rotated_utils.h"
#endif*/
#include "box_iou_rotated/box_iou_rotated_utils.h"

I guess the relative import wasn't working on windows. So I commented out the WITH_CUDA and WITH_HIP checks and instead just used #include "box_iou_rotated/box_iou_rotated_utils.h"

thank u ,it works for me !

Was this page helpful?
0 / 5 - 0 ratings