WSL2 中的 Ubuntu 22.04 无法安装 detectorron2

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

我已经尝试在我的 ubuntu WSL 实例上安装 detectorron2 三周了。我关注了官方网站上的无数帖子和文档。

Detectron2

我已经逐行查看了错误消息并查找丢失的软件包。

我没有主意了,这是我已在 linux 和 pip 中安装的软件包列表: 如果有人有任何想法请帮助我。我现在正处于尝试学习新技能变得需要付出太多努力的阶段。

WSL 命令

安装所有必需的软件包后,我仍然收到以下错误:

nstalling collected packages: detectron2

为 detectorron2 运行 setup.py 开发 错误:子进程退出并出现错误

 python setup.py develop did not run successfully.
exit code: 1
98 lines of output]
    running develop
    /home/goat/ocr/lib/python3.10/site-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    /home/goat/ocr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    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/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 11.8
      warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
    building 'detectron2._C' extension
    Emitting ninja build file /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/build.ninja...
    Compiling objects...
    Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
    [1/2] c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.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
    FAILED: /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o
    c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.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/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/detail/../attr.h:13,
                     from /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/detail/class.h:12,
                     from /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/pybind11.h:13,
                     from /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/numpy.h:12,
                     from /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.h:4,
                     from /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp:2:
    /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/detail/../detail/common.h:266:10: fatal error: Python.h: No such file or directory
      266 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    [2/2] c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/vision.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/vision.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/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
    FAILED: /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/vision.o
    c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/vision.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/vision.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/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/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/Device.h:4,
                     from /home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/python.h:8,
                     from /home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/extension.h:9,
                     from /home/goat/ocr/detectron2/detectron2/layers/csrc/vision.cpp:3:
    /home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/python_headers.h:12:10: fatal error: Python.h: No such file or directory
       12 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    ninja: build stopped: subcommand failed.
    Traceback (most recent call last):
      File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build
        subprocess.run(
      File "/usr/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/goat/ocr/detectron2/setup.py", line 151, in <module>
        setup(
      File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 79, in run
        _build_ext.run(self)
      File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 873, in build_extensions
        build_ext.build_extensions(self)
      File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
        self._build_extensions_serial()
      File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
        self.build_extension(ext)
      File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
        _build_ext.build_extension(self, ext)
      File "/home/goat/ocr/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension
        super(build_ext, self).build_extension(ext)
      File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
        objects = self.compiler.compile(sources,
      File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile
        _write_ninja_file_and_compile_objects(
      File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
        _run_ninja_build(
      File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
        raise RuntimeError(message) from e
    RuntimeError: Error compiling objects for extension
    [end of output]


python setup.py develop did not run successfully.
exit code: 1
running develop
/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
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/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 11.8
  warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
building 'detectron2._C' extension
Emitting ninja build file /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.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
FAILED: /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o
c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.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/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/detail/../attr.h:13,
                 from /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/detail/class.h:12,
                 from /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/pybind11.h:13,
                 from /home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/numpy.h:12,
                 from /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.h:4,
                 from /home/goat/ocr/detectron2/detectron2/layers/csrc/cocoeval/cocoeval.cpp:2:
/home/goat/ocr/lib/python3.10/site-packages/torch/include/pybind11/detail/../detail/common.h:266:10: fatal error: Python.h: No such file or directory
  266 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
[2/2] c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/vision.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/vision.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/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
FAILED: /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/vision.o
c++ -MMD -MF /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/detectron2/detectron2/layers/csrc/vision.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/goat/ocr/detectron2/detectron2/layers/csrc -I/home/goat/ocr/lib/python3.10/site-packages/torch/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/TH -I/home/goat/ocr/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/goat/ocr/include -I/usr/include/python3.10 -c -c /home/goat/ocr/detectron2/detectron2/layers/csrc/vision.cpp -o /home/goat/ocr/detectron2/build/temp.linux-x86_64-3.10/home/goat/ocr/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/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/Device.h:4,
                 from /home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/python.h:8,
                 from /home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/extension.h:9,
                 from /home/goat/ocr/detectron2/detectron2/layers/csrc/vision.cpp:3:
/home/goat/ocr/lib/python3.10/site-packages/torch/include/torch/csrc/python_headers.h:12:10: fatal error: Python.h: No such file or directory
   12 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build
    subprocess.run(
  File "/usr/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.

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "<pip-setuptools-caller>", line 34, in <module>
  File "/home/goat/ocr/detectron2/setup.py", line 151, in <module>
    setup(
  File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
    self.install_for_development()
  File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/develop.py", line 114, in install_for_development
    self.run_command('build_ext')
  File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 873, in build_extensions
    build_ext.build_extensions(self)
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/goat/ocr/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/goat/ocr/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension
    super(build_ext, self).build_extension(ext)
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
    objects = self.compiler.compile(sources,
  File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "/home/goat/ocr/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]
pytorch windows-subsystem-for-linux ubuntu-22.04 detectron
1个回答
0
投票

使用以下命令安装 python 标头: $sudo apt-get install python3.8-dev

希望有帮助

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