torch/utils/cpp_extension.py raise RuntimeError(message) from e

torch/utils/cpp_extension.py", line 1682, in _run_ninja_build

raise RuntimeError(message) from e

RuntimeError: Error compiling objects for extension

想配置这个FCOS算法的环境。
https://github.com/tianzhi0549/FCOS

在极链AI云平台上部署
优势:价格便宜,按实际使用时间扣费,适合学生进行科研探索;使用灵活,即用即停;选择较多,可以选择不同的Pytorch、Python、CUDA版本。
官网:https://cloud.videojj.com

部署:
根据https://github.com/tianzhi0549/FCOS/blob/master/INSTALL.md
都在最后一步python setup.py build develop --no-deps之后出现的问题
分别尝试了以下两种环境,分别遇到如下问题。
看了一些帖子说是版本问题,还在解决中。

Pytorch 1.8,python 3.8,CUDA 11.1.1
Pytorch 1.6.0,python 3.6,CUDA 10.2
Traceback (most recent call last):
  File "setup.py", line 77, in 
    include_package_data=True,
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 75, in run
    _build_ext.run(self)
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
    build_ext.build_extensions(self)
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
    _build_ext.build_extension(self, ext)
  File "/opt/conda/envs/FCOS/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 539, in unix_wrap_ninja_compile
    with_cuda=with_cuda)
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1360, in _write_ninja_file_and_compile_objects
    error_prefix='Error compiling objects for extension')
  File "/opt/conda/envs/FCOS/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
Traceback (most recent call last):
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1666, in _run_ninja_build
    subprocess.run(
  File "/opt/conda/envs/FCOS/lib/python3.9/subprocess.py", line 528, 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 "/root/FCOS/setup.py", line 66, in 
    setup(
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
    build_ext.build_extensions(self)
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
    _build_ext.build_extension(self, ext)
  File "/opt/conda/envs/FCOS/lib/python3.9/distutils/command/build_ext.py", line 529, in build_extension
    objects = self.compiler.compile(sources,
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 530, in unix_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1355, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "/opt/conda/envs/FCOS/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

你可能感兴趣的:(torch/utils/cpp_extension.py raise RuntimeError(message) from e)