facebookresearch / facebookresearch/detectron2

Can't install Detectron2

Open
#5,008 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

## Instructions To Reproduce the 🐛 Bug:
1. Full runnable code or full changes you made:
```
conda create -n detectronTestNew python=3.8.10
conda activate detectronTestNew
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
```
2. __Full logs__ or other relevant observations:
```
(downloads and copies done before are ommited)
copying detectron2/model_zoo/configs/COCO-Detection/retinanet_R_50_FPN_1x.py -> build/lib.linux-x86_64-cpython-38/detectron2/model_zoo/configs/COCO-Detection
copying detectron2/model_zoo/configs/COCO-Detection/fcos_R_50_FPN_1x.py -> build/lib.linux-x86_64-cpython-38/detectron2/model_zoo/configs/COCO-Detection
running build_ext
building 'detectron2._C' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/tmp
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/ROIAlignRotated
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/box_iou_rotated
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/cocoeval
creating build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/nms_rotated
gcc -pthread -B /home/pedrobolsa/anaconda3/envs/detectronTestNew/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/TH -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/THC -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/include/python3.8 -c /tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp -o build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_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
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/pedrobolsa/anaconda3/envs/detectronTestNew/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/TH -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/THC -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/include/python3.8 -c /tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp -o build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_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
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/pedrobolsa/anaconda3/envs/detectronTestNew/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/TH -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/THC -I/home/pedrobolsa/anaconda3/envs/detectronTestNew/include/python3.8 -c /tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/cocoeval/cocoeval.cpp -o build/temp.linux-x86_64-cpython-38/tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/cocoeval/cocoeval.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
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:45,
from /home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/numpy.h:12,
from /tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/cocoeval/cocoeval.h:4,
from /tmp/pip-req-build-dlzbi57q/detectron2/layers/csrc/cocoeval/cocoeval.cpp:2:
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:199:10: error: ‘uint16_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
199 | std::uint16_t nargs;
| ^~~~~~~~
| wint_t
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:202:10: error: ‘uint16_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
202 | std::uint16_t nargs_kw_only = 0;
| ^~~~~~~~
| wint_t
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:205:10: error: ‘uint16_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
205 | std::uint16_t nargs_pos_only = 0;
| ^~~~~~~~
| wint_t
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h: In constructor ‘pybind11::detail::function_call::function_call(const pybind11::detail::function_record&, pybind11::handle)’:
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:310:20: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs’; did you mean ‘args’?
310 | args.reserve(f.nargs);
| ^~~~~
| args
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:311:28: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs’; did you mean ‘args’?
311 | args_convert.reserve(f.nargs);
| ^~~~~
| args
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h: In function ‘void pybind11::detail::process_kw_only_arg(const pybind11::arg&, function_record*)’:
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:382:10: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs_kw_only’
382 | ++r->nargs_kw_only;
| ^~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h: In static member function ‘static void pybind11::detail::process_attribute::init(const pybind11::pos_only&, pybind11::detail::function_record*)’:
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:439:12: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs_pos_only’
439 | r->nargs_pos_only = static_cast(r->args.size());
| ^~~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/attr.h:439:46: error: ‘uint16_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
439 | r->nargs_pos_only = static_cast(r->args.size());
| ^~~~~~~~
| wint_t
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h: In member function ‘void pybind11::cpp_function::initialize_generic(unique_function_record&&, const char*, const std::type_info* const*, pybind11::size_t)’:
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:311:26: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs_kw_only’
311 | if (rec->nargs_kw_only > 0 && arg_index + rec->nargs_kw_only == args)
| ^~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:311:64: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs_kw_only’
311 | if (rec->nargs_kw_only > 0 && arg_index + rec->nargs_kw_only == args)
| ^~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:329:26: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs_pos_only’
329 | if (rec->nargs_pos_only > 0 && (arg_index + 1) == rec->nargs_pos_only)
| ^~~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:329:72: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs_pos_only’
329 | if (rec->nargs_pos_only > 0 && (arg_index + 1) == rec->nargs_pos_only)
| ^~~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:371:14: error: ‘struct pybind11::detail::function_record’ has no member named ‘nargs’; did you mean ‘args’?
371 | rec->nargs = (std::uint16_t) args;
| ^~~~~
| args
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:371:28: error: ‘uint16_t’ is not a member of ‘std’; did you mean ‘wint_t’?
371 | rec->nargs = (std::uint16_t) args;
| ^~~~~~~~
| wint_t
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h: In static member function ‘static PyObject* pybind11::cpp_function::dispatcher(PyObject*, PyObject*, PyObject*)’:
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:604:40: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs’; did you mean ‘args’?
604 | size_t num_args = func.nargs; // Number of positional arguments that we need
| ^~~~~
| args
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:607:51: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs_kw_only’
607 | size_t pos_args = num_args - func.nargs_kw_only;
| ^~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:657:40: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs_pos_only’
657 | if (args_copied < func.nargs_pos_only) {
| ^~~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:658:47: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs_pos_only’
658 | for (; args_copied < func.nargs_pos_only; ++args_copied) {
| ^~~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:672:44: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs_pos_only’
672 | if (args_copied < func.nargs_pos_only)
| ^~~~~~~~~~~~~~
/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch/include/pybind11/pybind11.h:760:53: error: ‘const struct pybind11::detail::function_record’ has no member named ‘nargs’; did you mean ‘args’?
760 | second_pass_convert.resize(func.nargs, false);
| ^~~~~
| args
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for detectron2
Running setup.py clean for detectron2
Failed to build detectron2
ERROR: Could not build wheels for detectron2, which is required to install pyproject.toml-based projects
```

## Environment:

Provide your environment information using the following command:
```
------------------------------- ------------------------------------------------------------------------------------------------
sys.platform linux
Python 3.8.10 (default, Jun 4 2021, 15:09:15) [GCC 7.5.0]
numpy 1.24.3
detectron2 failed to import
detectron2._C not built correctly: No module named 'detectron2'
Compiler ($CXX) c++ (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4)
DETECTRON2_ENV_MODULE
PyTorch 1.10.0 @/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torch
PyTorch debug build False
torch._C._GLIBCXX_USE_CXX11_ABI False
GPU available Yes
GPU 0 NVIDIA GeForce RTX 3080 Laptop GPU (arch=8.6)
Driver version 530.41.03
CUDA_HOME None - invalid!
Pillow 8.2.0
torchvision 0.11.0 @/home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torchvision
torchvision arch flags /home/pedrobolsa/anaconda3/envs/detectronTestNew/lib/python3.8/site-packages/torchvision/_C.so
cv2 Not found
------------------------------- ------------------------------------------------------------------------------------------------
PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX512
- CUDA Runtime 11.3
- 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_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
- CuDNN 8.2
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -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-psabi -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, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.0, USE_CUDA=ON, USE_CUDNN=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,
```

Hope someone can help me out. Thanks!

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported conda and pip installation commands, then start with the detectron2/layers/csrc build output and the PyTorch pybind11 headers shown in the log. The issue is done when the documented environment can install Detectron2 successfully without the reported C++ compilation errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
build-system, computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.