captainfffsama / detectron2

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

RTX4090 install raise nvcc fatal : Unsupported gpu architecture 'compute_89' #1

Closed captainfffsama closed 3 months ago

captainfffsama commented 3 months ago

Problem

when run pip install -e . on RTX4090.raise:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Obtaining file:///home/chiebot-cv/project/hq_workspace/detectron2
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Pillow>=7.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (9.3.0)
Requirement already satisfied: matplotlib in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (3.9.0)
Requirement already satisfied: pycocotools>=2.0.2 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (2.0.7)
Requirement already satisfied: termcolor>=1.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (2.4.0)
Requirement already satisfied: yacs>=0.1.8 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (0.1.8)
Requirement already satisfied: tabulate in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (0.9.0)
Requirement already satisfied: cloudpickle in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (3.0.0)
Requirement already satisfied: tqdm>4.29.0 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (4.66.4)
Requirement already satisfied: tensorboard in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (2.17.0)
Requirement already satisfied: fvcore<0.1.6,>=0.1.5 in /home/chiebot-cv/.local/lib/python3.10/site-packages/fvcore-0.1.5.post20220305-py3.10.egg (from detectron2==0.6) (0.1.5.post20220305)
Requirement already satisfied: iopath<0.1.10,>=0.1.7 in /home/chiebot-cv/.local/lib/python3.10/site-packages/iopath-0.1.9-py3.10.egg (from detectron2==0.6) (0.1.9)
Requirement already satisfied: omegaconf<2.4,>=2.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (2.1.2)
Requirement already satisfied: hydra-core>=1.1 in /home/chiebot-cv/.local/lib/python3.10/site-packages/hydra_core-1.2.0.dev3-py3.10.egg (from detectron2==0.6) (1.2.0.dev3)
Requirement already satisfied: black in /home/chiebot-cv/.local/lib/python3.10/site-packages/black-21.4b2-py3.10.egg (from detectron2==0.6) (21.4b2)
Requirement already satisfied: packaging in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from detectron2==0.6) (24.1)
Requirement already satisfied: numpy in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from fvcore<0.1.6,>=0.1.5->detectron2==0.6) (1.26.4)
Requirement already satisfied: pyyaml>=5.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from fvcore<0.1.6,>=0.1.5->detectron2==0.6) (6.0.1)
Requirement already satisfied: antlr4-python3-runtime==4.8 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from hydra-core>=1.1->detectron2==0.6) (4.8)
Requirement already satisfied: portalocker in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from iopath<0.1.10,>=0.1.7->detectron2==0.6) (2.8.2)
Requirement already satisfied: contourpy>=1.0.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from matplotlib->detectron2==0.6) (1.2.1)
Requirement already satisfied: cycler>=0.10 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from matplotlib->detectron2==0.6) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from matplotlib->detectron2==0.6) (4.53.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from matplotlib->detectron2==0.6) (1.4.5)
Requirement already satisfied: pyparsing>=2.3.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from matplotlib->detectron2==0.6) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from matplotlib->detectron2==0.6) (2.9.0.post0)
Requirement already satisfied: click>=7.1.2 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from black->detectron2==0.6) (8.1.7)
Requirement already satisfied: appdirs in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from black->detectron2==0.6) (1.4.4)
Requirement already satisfied: toml>=0.10.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from black->detectron2==0.6) (0.10.2)
Requirement already satisfied: regex>=2020.1.8 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from black->detectron2==0.6) (2024.5.15)
Requirement already satisfied: pathspec<1,>=0.8.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from black->detectron2==0.6) (0.12.1)
Requirement already satisfied: mypy-extensions>=0.4.3 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from black->detectron2==0.6) (1.0.0)
Requirement already satisfied: absl-py>=0.4 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (2.1.0)
Requirement already satisfied: grpcio>=1.48.2 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (1.64.1)
Requirement already satisfied: markdown>=2.6.8 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (3.6)
Requirement already satisfied: protobuf!=4.24.0,<5.0.0,>=3.19.6 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (4.25.3)
Requirement already satisfied: setuptools>=41.0.0 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (69.5.1)
Requirement already satisfied: six>1.9 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (1.16.0)
Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (0.7.2)
Requirement already satisfied: werkzeug>=1.0.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (3.0.3)
Requirement already satisfied: MarkupSafe>=2.1.1 in /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages (from werkzeug>=1.0.1->tensorboard->detectron2==0.6) (2.1.3)
Installing collected packages: detectron2
  Running setup.py develop for detectron2
    error: subprocess-exited-with-error

    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [159 lines of output]
        running develop
        /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
        !!

                ********************************************************************************
                Please avoid running ``setup.py`` and ``easy_install``.
                Instead, use pypa/build, pypa/installer or other
                standards-based tools.

                See https://github.com/pypa/setuptools/issues/917 for details.
                ********************************************************************************

        !!
          easy_install.initialize_options(self)
        /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
        !!

                ********************************************************************************
                Please avoid running ``setup.py`` directly.
                Instead, use pypa/build, pypa/installer or other
                standards-based tools.

                See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
                ********************************************************************************

        !!
          self.initialize_options()
        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'
        adding license file 'LICENSE'
        writing manifest file 'detectron2.egg-info/SOURCES.txt'
        running build_ext
        /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py:418: UserWarning: The detected CUDA version (11.7) has a minor version mismatch with the version that was used to compile PyTorch (11.8). Most likely this shouldn't be a problem.
          warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
        building 'detectron2._C' extension
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/box_iou_rotated
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/cocoeval
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/deformable
        creating /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/nms_rotated
        /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py:1967: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
        If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
          warnings.warn(
        Emitting ninja build file /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/build.ninja...
        Compiling objects...
        Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
        [1/11] /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o.d -DWITH_CUDA -I/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/TH -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/include/python3.10 -c -c /home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu -o /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_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 '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
        FAILED: /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o
        /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o.d -DWITH_CUDA -I/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/TH -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/include/python3.10 -c -c /home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu -o /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_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 '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
        nvcc fatal   : Unsupported gpu architecture 'compute_89'

    [11/11] c++ -MMD -MF /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/vision.o.d -pthread -B /home/chiebot-cv/anaconda3/envs/detecron2_hq/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/chiebot-cv/anaconda3/envs/detecron2_hq/include -fPIC -O2 -isystem /home/chiebot-cv/anaconda3/envs/detecron2_hq/include -fPIC -DWITH_CUDA -I/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/TH -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/chiebot-cv/anaconda3/envs/detecron2_hq/include/python3.10 -c -c /home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/vision.cpp -o /home/chiebot-cv/project/hq_workspace/detectron2/build/temp.linux-x86_64-cpython-310/home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/vision.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++17
    In file included from /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/torch/csrc/Exceptions.h:12,
                     from /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/python.h:11,
                     from /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/torch/extension.h:9,
                     from /home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/vision.cpp:3:
    /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/pybind11/pybind11.h: In instantiation of ‘class pybind11::class_<detectron2::COCOeval::InstanceAnnotation>’:
    /home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/vision.cpp:105:73:   required from here
    /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/pybind11/pybind11.h:1555:7: warning: ‘pybind11::class_<detectron2::COCOeval::InstanceAnnotation>’ declared with greater visibility than its base ‘pybind11::detail::generic_type’ [-Wattributes]
     1555 | class class_ : public detail::generic_type {
          |       ^~~~~~
    /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/pybind11/pybind11.h: In instantiation of ‘class pybind11::class_<detectron2::COCOeval::ImageEvaluation>’:
    /home/chiebot-cv/project/hq_workspace/detectron2/detectron2/layers/csrc/vision.cpp:107:67:   required from here
    /home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/include/pybind11/pybind11.h:1555:7: warning: ‘pybind11::class_<detectron2::COCOeval::ImageEvaluation>’ declared with greater visibility than its base ‘pybind11::detail::generic_type’ [-Wattributes]
    ninja: build stopped: subcommand failed.
    Traceback (most recent call last):
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
        subprocess.run(
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/subprocess.py", line 526, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/home/chiebot-cv/project/hq_workspace/detectron2/setup.py", line 151, in <module>
        setup(
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
        return distutils.core.setup(**attrs)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
        return run_commands(dist)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
        dist.run_commands()
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
        self.run_command(cmd)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
        super().run_command(command)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
        cmd_obj.run()
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/command/develop.py", line 111, in install_for_development
        self.run_command('build_ext')
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
        self.distribution.run_command(command)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
        super().run_command(command)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
        cmd_obj.run()
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 91, in run
        _build_ext.run(self)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
        self.build_extensions()
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 870, in build_extensions
        build_ext.build_extensions(self)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
        self._build_extensions_serial()
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
        self.build_extension(ext)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 252, in build_extension
        _build_ext.build_extension(self, ext)
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 560, in build_extension
        objects = self.compiler.compile(
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 683, in unix_wrap_ninja_compile
        _write_ninja_file_and_compile_objects(
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1783, in _write_ninja_file_and_compile_objects
        _run_ninja_build(
      File "/home/chiebot-cv/anaconda3/envs/detecron2_hq/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2123, in _run_ninja_build
        raise RuntimeError(message) from e
    RuntimeError: Error compiling objects for extension
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
...
captainfffsama commented 3 months ago

Solution

get your env compute capability:

python -c "import torch; print(torch.cuda.get_device_capability())"

In my env, output is:

>>> (8, 6) 

It means that cuda in my env, compute capability is 8.6. We can set TORCH_CUDA_ARCH_LIST to fix this problem.

rm -rf build
export TORCH_CUDA_ARCH_LIST="8.6"
pip install -e .