无法在 MacOS 上使用 detectorron2 构建 Docker 镜像

问题描述 投票:0回答:2

问题是,我无法使用 Docker 来构建镜像。我使用在 GitHub 上找到的

官方
Dockerfile: detectron2

我被类似的事情压碎了
FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04 # 18.04 didn't work also ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y \ python3-opencv ca-certificates python3-dev git wget sudo ninja-build RUN ln -sv /usr/bin/python3 /usr/bin/python ARG USER_ID=1000 RUN useradd -m --no-log-init --system --uid ${USER_ID} appuser -g sudo RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers USER appuser WORKDIR /home/appuser ENV PATH="/home/appuser/.local/bin:${PATH}" RUN wget https://bootstrap.pypa.io/get-pip.py && \ python3 get-pip.py --user && \ rm get-pip.py RUN pip install --user tensorboard cmake onnx # cmake from apt-get is too old RUN pip install --user torch==1.10 torchvision==0.11.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html RUN pip install --user 'git+https://github.com/facebookresearch/fvcore' RUN git clone https://github.com/facebookresearch/detectron2 detectron2_repo ENV FORCE_CUDA="1" ARG TORCH_CUDA_ARCH_LIST="Kepler;Kepler+Tesla;Maxwell;Maxwell+Tegra;Pascal;Volta;Turing" ENV TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}" RUN pip install --user -e detectron2_repo ENV FVCORE_CACHE="/tmp" WORKDIR /home/appuser/detectron2_repo RUN pip install --user jupyterlab RUN pip install opencv-python RUN pip install Flask RUN pip install Flask-RESTful RUN pip install Werkzeug

。结果我得到了巨大的日志,但最终结果是:

RUN pip install --user -e detectron2_repo

我猜这是关于
#15 228.7 nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). #15 228.7 ninja: build stopped: subcommand failed. #15 228.7 Traceback (most recent call last): #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1717, in _run_ninja_build #15 228.7 subprocess.run( #15 228.7 File "/usr/lib/python3.8/subprocess.py", line 516, in run #15 228.7 raise CalledProcessError(retcode, process.args, #15 228.7 subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1. #15 228.7 #15 228.7 The above exception was the direct cause of the following exception: #15 228.7 #15 228.7 Traceback (most recent call last): #15 228.7 File "<string>", line 2, in <module> #15 228.7 File "<pip-setuptools-caller>", line 34, in <module> #15 228.7 File "/home/appuser/detectron2_repo/setup.py", line 147, in <module> #15 228.7 setup( #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup #15 228.7 return distutils.core.setup(**attrs) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup #15 228.7 return run_commands(dist) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands #15 228.7 dist.run_commands() #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands #15 228.7 self.run_command(cmd) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command #15 228.7 super().run_command(command) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command #15 228.7 cmd_obj.run() #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/command/develop.py", line 34, in run #15 228.7 self.install_for_development() #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/command/develop.py", line 114, in install_for_development #15 228.7 self.run_command('build_ext') #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command #15 228.7 self.distribution.run_command(command) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command #15 228.7 super().run_command(command) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command #15 228.7 cmd_obj.run() #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 84, in run #15 228.7 _build_ext.run(self) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run #15 228.7 self.build_extensions() #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 735, in build_extensions #15 228.7 build_ext.build_extensions(self) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions #15 228.7 self._build_extensions_serial() #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial #15 228.7 self.build_extension(ext) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 246, in build_extension #15 228.7 _build_ext.build_extension(self, ext) #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 549, in build_extension #15 228.7 objects = self.compiler.compile( #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 556, in unix_wrap_ninja_compile #15 228.7 _write_ninja_file_and_compile_objects( #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1399, in _write_ninja_file_and_compile_objects #15 228.7 _run_ninja_build( #15 228.7 File "/home/appuser/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1733, in _run_ninja_build #15 228.7 raise RuntimeError(message) from e #15 228.7 RuntimeError: Error compiling objects for extension #15 228.7 [end of output] #15 228.7 #15 228.7 note: This error originates from a subprocess, and is likely not a problem with pip. ------ executor failed running [/bin/sh -c pip install --user -e detectron2_repo]: exit code: 1

的事情,但我不太确定,因为docker在隔离环境中工作。

这是我电脑的配置:

MacBook Pro
  • 2,4 GHz 四核英特尔酷睿 i5
  • 英特尔 Iris Plus 显卡 655 1536 MB
  • 8 GB 2133 MHz LPDDR3
python docker macos pip detectron
2个回答
0
投票


0
投票

您可以在图像终端中通过

cuda

查看。

要安装具有 cuda 兼容架构的映像,请在 

$ uname -m

中的

--platform=linux/amd64
之后添加
FROM

Dockerfile

    

© www.soinside.com 2019 - 2024. All rights reserved.