facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
29.32k stars 7.32k forks source link

Can't install Detectron 2 on MacOS (intel Mac) #5216

Open tripathi-genius opened 4 months ago

tripathi-genius commented 4 months ago

I tried to run installation of Detectron 2 and I followed all the available links on GitHub, but I still got the following error:

Building wheels for collected packages: detectron2
  Building wheel for detectron2 (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [641 lines of output]
      running bdist_wheel
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/utils/cpp_extension.py:500: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      creating build/lib.macosx-10.9-universal2-cpython-311/tools
      copying tools/lightning_train_net.py -> build/lib.macosx-10.9-universal2-cpython-311/tools
... ...
      copying detectron2/model_zoo/configs/quick_schedules/mask_rcnn_R_50_FPN_training_acc_test.yaml -> build/lib.macosx-
      copying detectron2/model_zoo/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.py -> build/lib.macosx-10.9-universal2-cpython-311/detectron2/model_zoo/configs/COCO-InstanceSegmentation
      warning: build_py: byte-compiling is disabled, skipping.

      running build_ext
      building 'detectron2._C' extension
      creating build/temp.macosx-10.9-universal2-cpython-311
      creating build/temp.macosx-10.9-universal2-cpython-311/private
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/box_iou_rotated
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/cocoeval
      creating build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/nms_rotated
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -g -arch x86_64 -I/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc -I/Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include -I/Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/TH -I/Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/THC -I/Users/shashwattripathi/my_test/venv/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp -o build/temp.macosx-10.9-universal2-cpython-311/private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_clang\" -DPYBIND11_STDLIB=\"_libcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1002\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:28:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/util/OptionalArrayRef.h:159:34: error: 'value' is unavailable: introduced in macOS 10.13
          return wrapped_opt_array_ref.value();
                                       ^
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/util/OptionalArrayRef.h:222:13: note: in instantiation of member function 'c10::OptionalArrayRef<long long>::value' requested here
        return a1.value() == other;
                  ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:950:33: note: 'value' has been explicitly marked unavailable here
          constexpr value_type const& value() const&
                                      ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:31:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/CheckMemoryFormat.h:11:35: error: 'value' is unavailable: introduced in macOS 10.13
            options.requires_grad_opt().value() == false,
                                        ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:968:28: note: 'value' has been explicitly marked unavailable here
          constexpr value_type&& value() &&
                                 ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:33:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/DeprecatedTypeProperties.h:110:34: error: 'value' is unavailable: introduced in macOS 10.13
            Device device = device_opt.value();
                                       ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:442:26: error: 'value' is unavailable: introduced in macOS 10.13
            TORCH_CHECK(inputs.value().size() > 0, "'inputs' argument to backward cannot be empty")
                               ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:443:30: error: 'value' is unavailable: introduced in macOS 10.13
            this->_backward(inputs.value(), gradient, retain_graph, create_graph);
                                   ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:28:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/util/OptionalArrayRef.h:131:34: error: 'value' is unavailable: introduced in macOS 10.13
          return wrapped_opt_array_ref.value();
                                       ^
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:5606:152: note: in instantiation of member function 'c10::OptionalArrayRef<long long>::operator*' requested here
          return at::_ops::to_padded_tensor::call(const_cast<Tensor&>(*this), padding, output_size.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*output_size)) : c10::nullopt);
                                                                                                                                                             ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef.h:631:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef_inl.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List.h:490:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List_inl.h:4:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue.h:1551:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue_inl.h:12:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/jit_type.h:662:24: error: 'value' is unavailable: introduced in macOS 10.13
            prod *= shape[i].value();
                             ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:950:33: note: 'value' has been explicitly marked unavailable here
          constexpr value_type const& value() const&
                                      ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef.h:631:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef_inl.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List.h:490:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List_inl.h:4:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue.h:1551:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue_inl.h:12:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/jit_type.h:1512:28: error: 'value' is unavailable: introduced in macOS 10.13
          const auto& n = name().value();
                                 ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:950:33: note: 'value' has been explicitly marked unavailable here
          constexpr value_type const& value() const&
                                      ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef.h:631:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef_inl.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List.h:490:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List_inl.h:4:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue.h:1551:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue_inl.h:12:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/jit_type.h:2129:20: error: 'value' is unavailable: introduced in macOS 10.13
          return reason_.value();
                         ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:950:33: note: 'value' has been explicitly marked unavailable here
          constexpr value_type const& value() const&
                                      ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef.h:631:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef_inl.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List.h:490:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List_inl.h:4:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue.h:1551:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue_inl.h:16:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/core/DeviceGuard.h:3:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/core/impl/InlineDeviceGuard.h:230:33: error: 'value' is unavailable: introduced in macOS 10.13
            guard_.emplace(device_opt.value());
                                      ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef.h:631:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef_inl.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List.h:490:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List_inl.h:4:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue.h:1551:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue_inl.h:16:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/core/DeviceGuard.h:3:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/core/impl/InlineDeviceGuard.h:242:39: error: 'value' is unavailable: introduced in macOS 10.13
            guard_.emplace(device_index_opt.value());
                                            ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef.h:631:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/IListRef_inl.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List.h:490:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/List_inl.h:4:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue.h:1551:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/ivalue_inl.h:20:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/core/StreamGuard.h:3:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/core/impl/InlineStreamGuard.h:146:33: error: 'value' is unavailable: introduced in macOS 10.13
            guard_.emplace(stream_opt.value());
                                      ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:9:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/DeviceGuard.h:27:38: error: 'value' is unavailable: introduced in macOS 10.13
        return t.has_value() ? device_of(t.value()) : c10::nullopt;
                                           ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:950:33: note: 'value' has been explicitly marked unavailable here
          constexpr value_type const& value() const&
                                      ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:18:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorIndexing.h:13:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/NativeFunctions.h:37:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ops/_addmm_activation_native.h:15:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ops/_addmm_activation_meta.h:12:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorIterator.h:311:34: error: 'value' is unavailable: introduced in macOS 10.13
          return operands_[arg].device.value();
                                       ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:950:33: note: 'value' has been explicitly marked unavailable here
          constexpr value_type const& value() const&
                                      ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:18:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorIndexing.h:48:37: error: 'value' is unavailable: introduced in macOS 10.13
            step_ = std::move(step_index).value();
                                          ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:968:28: note: 'value' has been explicitly marked unavailable here
          constexpr value_type&& value() &&
                                 ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:18:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorIndexing.h:56:39: error: 'value' is unavailable: introduced in macOS 10.13
            start_ = std::move(start_index).value();
                                            ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:968:28: note: 'value' has been explicitly marked unavailable here
          constexpr value_type&& value() &&
                                 ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:18:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorIndexing.h:62:37: error: 'value' is unavailable: introduced in macOS 10.13
            stop_ = std::move(stop_index).value();
                                          ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:968:28: note: 'value' has been explicitly marked unavailable here
          constexpr value_type&& value() &&
                                 ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:3:
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/ATen.h:18:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorIndexing.h:243:25: error: 'value' is unavailable: introduced in macOS 10.13
                !(maybe_index.value() == 0 && dim == 0 && self_sizes->empty()),
                              ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      In file included from /private/var/folders/zc/mb4184bj2v5gfcsc5j8y_f4r0000gn/T/pip-req-build-0jx34iss/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp:2:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/TensorUtils.h:5:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/Tensor.h:3:
      In file included from /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:28:
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/c10/util/OptionalArrayRef.h:155:34: error: 'value' is unavailable: introduced in macOS 10.13
          return wrapped_opt_array_ref.value();
                                       ^
      /Users/shashwattripathi/my_test/venv/lib/python3.11/site-packages/torch/include/ATen/WrapDimUtilsMulti.h:26:26: note: in instantiation of member function 'c10::OptionalArrayRef<long long>::value' requested here
          auto dims = opt_dims.value();
                               ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:959:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      error: command '/usr/bin/clang' 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

The installation is attempted on python 3.11.1 and the files in virtual environment are:

Package                 Version
----------------------- ------------------
absl-py                 2.1.0
antlr4-python3-runtime  4.9.3
black                   24.1.1
cachetools              5.3.2
certifi                 2024.2.2
charset-normalizer      3.3.2
click                   8.1.7
cloudpickle             3.0.0
contourpy               1.2.0
cycler                  0.12.1
filelock                3.13.1
fonttools               4.48.1
fsspec                  2024.2.0
fvcore                  0.1.5.post20221221
google-auth             2.27.0
google-auth-oauthlib    1.2.0
grpcio                  1.60.1
hydra-core              1.3.2
idna                    3.6
iopath                  0.1.9
Jinja2                  3.1.3
kiwisolver              1.4.5
Markdown                3.5.2
MarkupSafe              2.1.5
matplotlib              3.8.2
mpmath                  1.3.0
mypy-extensions         1.0.0
networkx                3.2.1
numpy                   1.26.4
oauthlib                3.2.2
omegaconf               2.3.0
packaging               23.2
pathspec                0.12.1
pillow                  10.2.0
pip                     24.0
platformdirs            4.2.0
portalocker             2.8.2
protobuf                4.25.2
pyasn1                  0.5.1
pyasn1-modules          0.3.0
pycocotools             2.0.7
pyparsing               3.1.1
python-dateutil         2.8.2
PyYAML                  6.0.1
requests                2.31.0
requests-oauthlib       1.3.1
rsa                     4.9
setuptools              65.5.0
six                     1.16.0
sympy                   1.12
tabulate                0.9.0
tensorboard             2.15.2
tensorboard-data-server 0.7.2
termcolor               2.4.0
torch                   2.2.0
torchaudio              2.2.0
torchvision             0.17.0
tqdm                    4.66.2
typing_extensions       4.9.0
urllib3                 2.2.0
watchdog                1.0.2
Werkzeug                3.0.1
wheel                   0.42.0
yacs                    0.1.8

The OS details are:

OS: MACOS Monterey
Version: 12.7.3 (21H1015)
Device: Air (13-inch, 2017)
Processor: 1.8 GHz Dual-Core Intel Core i5
Memory: 8 GB 1600 MHz DDR3

To reproduce this problem:

  1. create a virtual environment and set the export ARCHFLAGS="-arch x86_64".
  2. You may use the pip file to install the dependencies.
  3. To install the file, run: CC=clang CXX=clang++ python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' as provided in the Detectron documentation. Please help me to solve this issue. Help is highly appreciated.
github-actions[bot] commented 4 months ago

You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template. The following information is missing: "Instructions To Reproduce the Issue and Full Logs";

tripathi-genius commented 4 months ago

I have edited the initial file and full logs are more than the permitted characters. I have given enough information for the devs to figure out error. Thank you for understanding.

apasarkar commented 4 months ago

I have the exact same issue on Mac OS Monterey 12.6, help greatly appreciated

mauri commented 4 months ago

Exact same error, Monterey 12.7 here

harsh244 commented 4 months ago

Same issue macOS Sonoma 14.3.1

EmmaMeeus commented 4 months ago

Also have this issue but with M1.

jandom commented 4 months ago

Ran with export MACOSX_DEPLOYMENT_TARGET=14.2 and it worked for me (obviously change to whatever your mac version is)