How do you install detectron2 in CUDA12 in docker?

880 views Asked by At

I am trying to install detectron2 in Docker with CUDA 12 and pytorch2.1.1. The build works when I replace the following:

pytorch:2.1.1-cuda12.1-cudnn8-devel -> pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel

Following is my docker image:

FROM pytorch/pytorch:2.1.1-cuda12.1-cudnn8-devel
WORKDIR /app

RUN pip install  tensorboard cmake onnx   # cmake from apt-get is too old
ARG TORCH_CUDA_ARCH_LIST="Kepler;Kepler+Tesla;Maxwell;Maxwell+Tegra;Pascal;Volta;Turing"
ENV TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}"

ENV FORCE_CUDA="1"



RUN apt update && apt-get install sudo wget git  g++ gcc -y
RUN pip install --upgrade pip
RUN pip install  'git+https://github.com/facebookresearch/fvcore'
# RUN rm -rf build/ **/*.so
RUN git clone https://github.com/facebookresearch/detectron2 detectron2_repo

RUN pip install -e detectron2_repo
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6  -y
ENV FVCORE_CACHE="/tmp"

WORKDIR /app

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

EXPOSE 9000

COPY . /app

CMD ["uvicorn", "app:app","--host", "0.0.0.0","--port", "9000"]

And I receive the following error:

 => ERROR [ 8/13] RUN pip install -e detectron2_repo                                                                                                                              114.6s
------
 > [ 8/13] RUN pip install -e detectron2_repo:
#0 1.335 Obtaining file:///app/detectron2_repo
#0 1.336   Preparing metadata (setup.py): started
#0 19.18   Preparing metadata (setup.py): finished with status 'done'
#0 19.22 Requirement already satisfied: Pillow>=7.1 in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (10.0.1)
#0 25.62 Collecting matplotlib (from detectron2==0.6)
#0 26.09   Downloading matplotlib-3.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.8 kB)
#0 26.17 Collecting pycocotools>=2.0.2 (from detectron2==0.6)
#0 26.22   Downloading pycocotools-2.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.1 kB)
#0 26.24 Requirement already satisfied: termcolor>=1.1 in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (2.3.0)
#0 26.24 Requirement already satisfied: yacs>=0.1.8 in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (0.1.8)
#0 26.24 Requirement already satisfied: tabulate in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (0.9.0)
#0 26.31 Collecting cloudpickle (from detectron2==0.6)
#0 26.36   Downloading cloudpickle-3.0.0-py3-none-any.whl.metadata (7.0 kB)
#0 26.38 Requirement already satisfied: tqdm>4.29.0 in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (4.65.0)
#0 26.38 Requirement already satisfied: tensorboard in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (2.15.1)
#0 26.52 Collecting fvcore<0.1.6,>=0.1.5 (from detectron2==0.6)
#0 26.56   Downloading fvcore-0.1.5.post20221221.tar.gz (50 kB)
#0 26.62      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.2/50.2 kB 859.4 kB/s eta 0:00:00
#0 26.63   Preparing metadata (setup.py): started
#0 26.87   Preparing metadata (setup.py): finished with status 'done'
#0 26.95 Collecting iopath<0.1.10,>=0.1.7 (from detectron2==0.6)
#0 27.00   Downloading iopath-0.1.9-py3-none-any.whl (27 kB)
#0 27.13 Collecting omegaconf<2.4,>=2.1 (from detectron2==0.6)
#0 27.18   Downloading omegaconf-2.3.0-py3-none-any.whl (79 kB)
#0 27.21      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 2.4 MB/s eta 0:00:00
#0 27.28 Collecting hydra-core>=1.1 (from detectron2==0.6)
#0 27.32   Downloading hydra_core-1.3.2-py3-none-any.whl (154 kB)
#0 27.38      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 154.5/154.5 kB 2.7 MB/s eta 0:00:00
#0 27.51 Collecting black (from detectron2==0.6)
#0 27.55   Downloading black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (66 kB)
#0 27.58      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.9/66.9 kB 2.9 MB/s eta 0:00:00
#0 27.58 Requirement already satisfied: packaging in /opt/conda/lib/python3.10/site-packages (from detectron2==0.6) (23.1)
#0 27.58 Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from fvcore<0.1.6,>=0.1.5->detectron2==0.6) (1.26.0)
#0 27.59 Requirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from fvcore<0.1.6,>=0.1.5->detectron2==0.6) (6.0.1)
#0 27.66 Collecting antlr4-python3-runtime==4.9.* (from hydra-core>=1.1->detectron2==0.6)
#0 27.70   Downloading antlr4-python3-runtime-4.9.3.tar.gz (117 kB)
#0 27.75      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.0/117.0 kB 2.1 MB/s eta 0:00:00
#0 27.77   Preparing metadata (setup.py): started
#0 27.95   Preparing metadata (setup.py): finished with status 'done'
#0 27.95 Requirement already satisfied: portalocker in /opt/conda/lib/python3.10/site-packages (from iopath<0.1.10,>=0.1.7->detectron2==0.6) (2.8.2)
#0 28.11 Collecting contourpy>=1.0.1 (from matplotlib->detectron2==0.6)
#0 28.16   Downloading contourpy-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.8 kB)
#0 28.24 Collecting cycler>=0.10 (from matplotlib->detectron2==0.6)
#0 28.28   Downloading cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
#0 28.48 Collecting fonttools>=4.22.0 (from matplotlib->detectron2==0.6)
#0 28.52   Downloading fonttools-4.45.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (155 kB)
#0 28.58      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.2/155.2 kB 2.5 MB/s eta 0:00:00
#0 28.80 Collecting kiwisolver>=1.3.1 (from matplotlib->detectron2==0.6)
#0 28.84   Downloading kiwisolver-1.4.5-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.metadata (6.4 kB)
#0 29.02 Collecting pyparsing>=2.3.1 (from matplotlib->detectron2==0.6)
#0 32.33   Downloading pyparsing-3.1.1-py3-none-any.whl.metadata (5.1 kB)
#0 32.61 Collecting python-dateutil>=2.7 (from matplotlib->detectron2==0.6)
#0 32.66   Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
#0 32.76      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 2.5 MB/s eta 0:00:00
#0 32.90 Requirement already satisfied: click>=8.0.0 in /opt/conda/lib/python3.10/site-packages (from black->detectron2==0.6) (8.1.7)
#0 33.02 Collecting mypy-extensions>=0.4.3 (from black->detectron2==0.6)
#0 33.07   Downloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
#0 33.22 Collecting pathspec>=0.9.0 (from black->detectron2==0.6)
#0 33.27   Downloading pathspec-0.11.2-py3-none-any.whl.metadata (19 kB)
#0 33.42 Collecting platformdirs>=2 (from black->detectron2==0.6)
#0 33.46   Downloading platformdirs-4.0.0-py3-none-any.whl.metadata (11 kB)
#0 33.51 Requirement already satisfied: tomli>=1.1.0 in /opt/conda/lib/python3.10/site-packages (from black->detectron2==0.6) (2.0.1)
#0 33.52 Requirement already satisfied: typing-extensions>=4.0.1 in /opt/conda/lib/python3.10/site-packages (from black->detectron2==0.6) (4.7.1)
#0 33.54 Requirement already satisfied: absl-py>=0.4 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (2.0.0)
#0 33.54 Requirement already satisfied: grpcio>=1.48.2 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (1.59.3)
#0 33.54 Requirement already satisfied: google-auth<3,>=1.6.3 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (2.23.4)
#0 33.54 Requirement already satisfied: google-auth-oauthlib<2,>=0.5 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (1.1.0)
#0 33.54 Requirement already satisfied: markdown>=2.6.8 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (3.5.1)
#0 33.54 Requirement already satisfied: protobuf<4.24,>=3.19.6 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (4.23.4)
#0 33.54 Requirement already satisfied: requests<3,>=2.21.0 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (2.31.0)
#0 33.54 Requirement already satisfied: setuptools>=41.0.0 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (68.0.0)
#0 33.55 Requirement already satisfied: six>1.9 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (1.16.0)
#0 33.55 Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (0.7.2)
#0 33.55 Requirement already satisfied: werkzeug>=1.0.1 in /opt/conda/lib/python3.10/site-packages (from tensorboard->detectron2==0.6) (3.0.1)
#0 33.68 Requirement already satisfied: cachetools<6.0,>=2.0.0 in /opt/conda/lib/python3.10/site-packages (from google-auth<3,>=1.6.3->tensorboard->detectron2==0.6) (5.3.2)
#0 33.68 Requirement already satisfied: pyasn1-modules>=0.2.1 in /opt/conda/lib/python3.10/site-packages (from google-auth<3,>=1.6.3->tensorboard->detectron2==0.6) (0.3.0)
#0 33.68 Requirement already satisfied: rsa<5,>=3.1.4 in /opt/conda/lib/python3.10/site-packages (from google-auth<3,>=1.6.3->tensorboard->detectron2==0.6) (4.9)
#0 33.71 Requirement already satisfied: requests-oauthlib>=0.7.0 in /opt/conda/lib/python3.10/site-packages (from google-auth-oauthlib<2,>=0.5->tensorboard->detectron2==0.6) (1.3.1)    
#0 33.89 Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2.21.0->tensorboard->detectron2==0.6) (2.0.4)
#0 33.89 Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2.21.0->tensorboard->detectron2==0.6) (3.4)
#0 33.89 Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2.21.0->tensorboard->detectron2==0.6) (1.26.18)
#0 33.89 Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2.21.0->tensorboard->detectron2==0.6) (2023.7.22)
#0 34.01 Requirement already satisfied: MarkupSafe>=2.1.1 in /opt/conda/lib/python3.10/site-packages (from werkzeug>=1.0.1->tensorboard->detectron2==0.6) (2.1.1)
#0 34.11 Requirement already satisfied: pyasn1<0.6.0,>=0.4.6 in /opt/conda/lib/python3.10/site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard->detectron2==0.6) (0.5.1)
#0 34.11 Requirement already satisfied: oauthlib>=3.0.0 in /opt/conda/lib/python3.10/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<2,>=0.5->tensorboard->detectron2==0.6) (3.2.2)
#0 41.15 Downloading pycocotools-2.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (426 kB)
#0 41.29    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 426.2/426.2 kB 3.2 MB/s eta 0:00:00
#0 41.35 Downloading matplotlib-3.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.6 MB)
#0 44.14    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.6/11.6 MB 4.3 MB/s eta 0:00:00
#0 44.18 Downloading black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB)
#0 44.45    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 6.5 MB/s eta 0:00:00
#0 44.49 Downloading cloudpickle-3.0.0-py3-none-any.whl (20 kB)
#0 44.54 Downloading contourpy-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (310 kB)
#0 44.61    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 310.7/310.7 kB 5.2 MB/s eta 0:00:00
#0 44.65 Downloading cycler-0.12.1-py3-none-any.whl (8.3 kB)
#0 44.71 Downloading fonttools-4.45.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB)
#0 46.65    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.6/4.6 MB 2.4 MB/s eta 0:00:00
#0 46.73 Downloading kiwisolver-1.4.5-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.6 MB)
#0 47.00    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 6.0 MB/s eta 0:00:00
#0 47.05 Downloading pathspec-0.11.2-py3-none-any.whl (29 kB)
#0 47.11 Downloading platformdirs-4.0.0-py3-none-any.whl (17 kB)
#0 47.16 Downloading pyparsing-3.1.1-py3-none-any.whl (103 kB)
#0 47.19    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.1/103.1 kB 4.5 MB/s eta 0:00:00
#0 47.23 Building wheels for collected packages: fvcore, antlr4-python3-runtime
#0 47.23   Building wheel for fvcore (setup.py): started
#0 47.55   Building wheel for fvcore (setup.py): finished with status 'done'
#0 47.55   Created wheel for fvcore: filename=fvcore-0.1.5.post20221221-py3-none-any.whl size=61400 sha256=6ac51dd638b160c0570b187992921373ae58beec964c702d1caa4d18d0060025
#0 47.55   Stored in directory: /root/.cache/pip/wheels/01/c0/af/77c1cf53a1be9e42a52b48e5af2169d40ec2e89f7362489dd0
#0 47.55   Building wheel for antlr4-python3-runtime (setup.py): started
#0 47.84   Building wheel for antlr4-python3-runtime (setup.py): finished with status 'done'
#0 47.84   Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.9.3-py3-none-any.whl size=144554 sha256=4251e9a70f954ef7562eea7185999a184d6634402ecb5abcb92c197ff655b0a1
#0 47.84   Stored in directory: /root/.cache/pip/wheels/12/93/dd/1f6a127edc45659556564c5730f6d4e300888f4bca2d4c5a88
#0 47.84 Successfully built fvcore antlr4-python3-runtime
#0 48.32 Installing collected packages: antlr4-python3-runtime, python-dateutil, pyparsing, platformdirs, pathspec, omegaconf, mypy-extensions, kiwisolver, iopath, fonttools, cycler, contourpy, cloudpickle, matplotlib, hydra-core, fvcore, black, pycocotools, detectron2
#0 51.15   Attempting uninstall: iopath
#0 51.15     Found existing installation: iopath 0.1.10
#0 51.16     Uninstalling iopath-0.1.10:
#0 51.18       Successfully uninstalled iopath-0.1.10
#0 61.15   Attempting uninstall: fvcore
#0 61.15     Found existing installation: fvcore 0.1.6
#0 61.15     Uninstalling fvcore-0.1.6:
#0 61.20       Successfully uninstalled fvcore-0.1.6
#0 61.52   Running setup.py develop for detectron2
#0 101.2     error: subprocess-exited-with-error
#0 101.2
#0 101.2     × python setup.py develop did not run successfully.
#0 101.2     │ exit code: 1
#0 101.2     ╰─> [60 lines of output]
#0 101.2         No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
#0 101.2         running develop
#0 101.2         /opt/conda/lib/python3.10/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
#0 101.2         !!
#0 101.2
#0 101.2                 ********************************************************************************
#0 101.2                 Please avoid running ``setup.py`` and ``easy_install``.
#0 101.2                 Instead, use pypa/build, pypa/installer or other
#0 101.2                 standards-based tools.
#0 101.2
#0 101.2                 See https://github.com/pypa/setuptools/issues/917 for details.
#0 101.2                 ********************************************************************************
#0 101.2
#0 101.2         !!
#0 101.2           easy_install.initialize_options(self)
#0 101.2         /opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
#0 101.2         !!
#0 101.2
#0 101.2                 ********************************************************************************
#0 101.2                 Please avoid running ``setup.py`` directly.
#0 101.2                 Instead, use pypa/build, pypa/installer or other
#0 101.2                 standards-based tools.
#0 101.2
#0 101.2                 See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
#0 101.2                 ********************************************************************************
#0 101.2
#0 101.2         !!
#0 101.2           self.initialize_options()
#0 101.2         running egg_info
#0 101.2         creating detectron2.egg-info
#0 101.2         writing detectron2.egg-info/PKG-INFO
#0 101.2         writing dependency_links to detectron2.egg-info/dependency_links.txt
#0 101.2         writing requirements to detectron2.egg-info/requires.txt
#0 101.2         writing top-level names to detectron2.egg-info/top_level.txt
#0 101.2         writing manifest file 'detectron2.egg-info/SOURCES.txt'
#0 101.2         /opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py:502: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
#0 101.2           warnings.warn(msg.format('we could not find ninja.'))
#0 101.2         reading manifest file 'detectron2.egg-info/SOURCES.txt'
#0 101.2         adding license file 'LICENSE'
#0 101.2         writing manifest file 'detectron2.egg-info/SOURCES.txt'
#0 101.2         running build_ext
#0 101.2         /opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 12.1
#0 101.2           warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
#0 101.2         building 'detectron2._C' extension
#0 101.2         creating build
#0 101.2         creating build/temp.linux-x86_64-cpython-310
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/ROIAlignRotated
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/box_iou_rotated
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/cocoeval
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/deformable
#0 101.2         creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/nms_rotated
#0 101.2         gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -DWITH_CUDA -I/app/detectron2_repo/detectron2/layers/csrc -I/opt/conda/lib/python3.10/site-packages/torch/include -I/opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.10/site-packages/torch/include/TH -I/opt/conda/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/include/python3.10 -c /app/detectron2_repo/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp -o build/temp.linux-x86_64-cpython-310/app/detectron2_repo/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++17
#0 101.2         /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/app/detectron2_repo/detectron2/layers/csrc -I/opt/conda/lib/python3.10/site-packages/torch/include -I/opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.10/site-packages/torch/include/TH -I/opt/conda/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/include/python3.10 -c /app/detectron2_repo/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu -o build/temp.linux-x86_64-cpython-310/app/detectron2_repo/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_35,code=compute_35 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_37,code=sm_37 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=compute_52 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_53,code=sm_53 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
#0 101.2         nvcc fatal   : Unsupported gpu architecture 'compute_35'
#0 101.2         error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1
#0 101.2         [end of output]
#0 101.2
#0 101.2     note: This error originates from a subprocess, and is likely not a problem with pip.
#0 101.3 error: subprocess-exited-with-error
#0 101.3
#0 101.3 × python setup.py develop did not run successfully.
#0 101.3 │ exit code: 1
#0 101.3 ╰─> [60 lines of output]
#0 101.3     No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
#0 101.3     running develop
#0 101.3     /opt/conda/lib/python3.10/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
#0 101.3     !!
#0 101.3
#0 101.3             ********************************************************************************
#0 101.3             Please avoid running ``setup.py`` and ``easy_install``.
#0 101.3             Instead, use pypa/build, pypa/installer or other
#0 101.3             standards-based tools.
#0 101.3
#0 101.3             See https://github.com/pypa/setuptools/issues/917 for details.
#0 101.3             ********************************************************************************
#0 101.3
#0 101.3     !!
#0 101.3       easy_install.initialize_options(self)
#0 101.3     /opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
#0 101.3     !!
#0 101.3
#0 101.3             ********************************************************************************
#0 101.3             Please avoid running ``setup.py`` directly.
#0 101.3             Instead, use pypa/build, pypa/installer or other
#0 101.3             standards-based tools.
#0 101.3
#0 101.3             See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
#0 101.3             ********************************************************************************
#0 101.3
#0 101.3     !!
#0 101.3       self.initialize_options()
#0 101.3     running egg_info
#0 101.3     creating detectron2.egg-info
#0 101.3     writing detectron2.egg-info/PKG-INFO
#0 101.3     writing dependency_links to detectron2.egg-info/dependency_links.txt
#0 101.3     writing requirements to detectron2.egg-info/requires.txt
#0 101.3     writing top-level names to detectron2.egg-info/top_level.txt
#0 101.3     writing manifest file 'detectron2.egg-info/SOURCES.txt'
#0 101.3     /opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py:502: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
#0 101.3       warnings.warn(msg.format('we could not find ninja.'))
#0 101.3     reading manifest file 'detectron2.egg-info/SOURCES.txt'
#0 101.3     adding license file 'LICENSE'
#0 101.3     writing manifest file 'detectron2.egg-info/SOURCES.txt'
#0 101.3     running build_ext
#0 101.3     /opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 12.1
#0 101.3       warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
#0 101.3     building 'detectron2._C' extension
#0 101.3     creating build
#0 101.3     creating build/temp.linux-x86_64-cpython-310
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/ROIAlignRotated
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/box_iou_rotated
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/cocoeval
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/deformable
#0 101.3     creating build/temp.linux-x86_64-cpython-310/app/detectron2_repo/detectron2/layers/csrc/nms_rotated
#0 101.3     gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -DWITH_CUDA -I/app/detectron2_repo/detectron2/layers/csrc -I/opt/conda/lib/python3.10/site-packages/torch/include -I/opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.10/site-packages/torch/include/TH -I/opt/conda/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/include/python3.10 -c /app/detectron2_repo/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp -o build/temp.linux-x86_64-cpython-310/app/detectron2_repo/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++17
#0 101.3     /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/app/detectron2_repo/detectron2/layers/csrc -I/opt/conda/lib/python3.10/site-packages/torch/include -I/opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.10/site-packages/torch/include/TH -I/opt/conda/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/include/python3.10 -c /app/detectron2_repo/detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu -o build/temp.linux-x86_64-cpython-310/app/detectron2_repo/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_35,code=compute_35 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_37,code=sm_37 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=compute_52 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_53,code=sm_53 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
#0 101.3     nvcc fatal   : Unsupported gpu architecture 'compute_35'
#0 101.3     error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1
#0 101.3     [end of output]
#0 101.3
#0 101.3 note: This error originates from a subprocess, and is likely not a problem with pip.
------
dockerfile:21
--------------------
  19 |     RUN git clone https://github.com/facebookresearch/detectron2 detectron2_repo
  20 |
  21 | >>> RUN pip install -e detectron2_repo
  22 |     ENV DEBIAN_FRONTEND noninteractive
  23 |     RUN apt-get update && apt-get install ffmpeg libsm6 libxext6  -y
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -e detectron2_repo" did not complete successfully: exit code: 1

Doesn't Detectron2 support CUDA 12.1? Or is it related to something else?

1

There are 1 answers

0
IcecreamArtist On

currently, detectron2 does not support CUDA 12. It seems that their newest version was released in Oct 2021.

There is a PR uploaded by @johnnynunez that create wheels automatically for CUDA 12. If you need to use detectron2 with CUDA 12, you can try this PR.

But I think a better choice is to use a docker with CUDA 11.