ERROR: Failed building wheel for onnx
解决依赖问题
没有安装protobuf
错误信息参考贴:https://github.com/onnx/onnx/issues/2481
解决办法:pip3 install protobuf
Protobuf compiler not found
错误信息:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/setup.py'"'"'; __file__='"'"'/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-jy6zy5qw
cwd: /tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/
Complete output (68 lines):
fatal: 不是一个 git 仓库(或者任何父目录):.git
/home/yaoz/.local/lib/python3.6/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
% (opt, underscore_opt))
/home/yaoz/.local/lib/python3.6/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
% (opt, underscore_opt))
running bdist_wheel
running build
running build_py
running create_version
running cmake_build
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Generated: /tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/.setuptools-cmake-build/onnx/onnx-ml.proto
CMake Error at CMakeLists.txt:248 (message):
Protobuf compiler not found
Call Stack (most recent call first):
CMakeLists.txt:279 (relative_protobuf_generate_cpp)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/setup.py", line 334, in <module>
'backend-test-tools = onnx.backend.test.cmd_tools:main',
File "/home/yaoz/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 204, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/setup.py", line 209, in run
self.run_command('cmake_build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af/setup.py", line 195, in run
subprocess.check_call(cmake_args)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '-DPYTHON_INCLUDE_DIR=/usr/include/python3.6m', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-36m-aarch64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/tmp/pip-install-38btlr9d/onnx_c5170763f41345449ba410a0157122af']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for onnx
问题原因:缺少Protobuf compiler
解决办法(安装好其它依赖):
sudo apt-get install -y libprotobuf-dev protobuf-compiler python3-scipy
注:要安装scipy建议安装1.4.1版本,建议参考我上一个帖:jetson nano安装tensorflow踩坑记录(scipy1.4.1)
fatal error: Python.h: 没有那个文件或目录
具体报错如下:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /home/yaoz/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpm_ittf0y
cwd: /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7
Complete output (247 lines):
fatal: 不是一个 git 仓库(或者任何父目录):.git
running bdist_wheel
running build
running build_py
running create_version
running cmake_build
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.9")
-- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython2.7.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Protobuf: /usr/lib/aarch64-linux-gnu/libprotobuf.so;-lpthread (found version "3.0.0")
Generated: /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-ml.proto
Generated: /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
Generated: /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-data.proto
CMake Warning at CMakeLists.txt:416 (find_package):
By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "pybind11",
but CMake did not find one.
Could not find a package configuration file provided by "pybind11"
(requested version 2.2) with any of the following names:
pybind11Config.cmake
pybind11-config.cmake
Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
"pybind11_DIR" to a directory containing one of the above files. If
"pybind11" provides a separate development package or SDK, be sure it has
been installed.
--
-- ******** Summary ********
-- CMake version : 3.10.2
-- CMake command : /usr/bin/cmake
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 7.5.0
-- CXX flags : -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions :
-- CMAKE_PREFIX_PATH :
-- CMAKE_INSTALL_PREFIX : /usr/local
-- CMAKE_MODULE_PATH :
--
-- ONNX version : 1.8.1
-- ONNX NAMESPACE : onnx
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNX_USE_LITE_PROTO : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
-- ONNXIFI_ENABLE_EXT : OFF
--
-- Protobuf compiler : /usr/bin/protoc
-- Protobuf includes : /usr/include
-- Protobuf libraries : /usr/lib/aarch64-linux-gnu/libprotobuf.so;-lpthread
-- BUILD_ONNX_PYTHON : ON
-- Python version :
-- Python executable : /usr/bin/python3
-- Python includes : /usr/include/python3.6m
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build
Scanning dependencies of target gen_onnx_proto
Scanning dependencies of target onnxifi_dummy
Scanning dependencies of target onnxifi_loader
[ 4%] Building C object CMakeFiles/onnxifi_dummy.dir/onnx/onnxifi_dummy.c.o
[ 4%] Running gen_proto.py on onnx/onnx.in.proto
[ 4%] Building C object CMakeFiles/onnxifi_loader.dir/onnx/onnxifi_loader.c.o
/tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/onnxifi_dummy.c: In function ‘onnxGetExtensionFunctionAddress’:
/tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/onnxifi_dummy.c:173:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
*function = &onnxGetExtensionFunctionAddress;
^
/tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/onnxifi_dummy.c:176:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
*function = &onnxSetIOAndRunGraph;
^
[ 6%] Linking C static library libonnxifi_loader.a
Processing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/onnx.in.proto
Writing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-ml.proto
Writing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-ml.proto3
generating /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx_pb.py
[ 7%] Linking C shared library libonnxifi_dummy.so
[ 9%] Running C++ protocol buffer compiler on /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-ml.proto
[ 9%] Built target onnxifi_loader
Scanning dependencies of target onnxifi_wrapper
[ 9%] Built target onnxifi_dummy
[ 10%] Building C object CMakeFiles/onnxifi_wrapper.dir/onnx/onnxifi_wrapper.c.o
Writing mypy to onnx/onnx_ml_pb2.pyi
[ 12%] Linking C shared module libonnxifi.so
[ 12%] Built target gen_onnx_proto
[ 15%] Running gen_proto.py on onnx/onnx-data.in.proto
[ 15%] Running gen_proto.py on onnx/onnx-operators.in.proto
[ 15%] Built target onnxifi_wrapper
Processing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/onnx-data.in.proto
Writing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-data.proto
Writing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-data.proto3
generating /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx_data_pb.py
Processing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/onnx-operators.in.proto
Writing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
Writing /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-operators-ml.proto3
generating /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx_operators_pb.py
[ 18%] Running C++ protocol buffer compiler on /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
[ 18%] Running C++ protocol buffer compiler on /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/.setuptools-cmake-build/onnx/onnx-data.proto
Writing mypy to onnx/onnx_data_pb2.pyi
Writing mypy to onnx/onnx_operators_ml_pb2.pyi
Scanning dependencies of target onnx_proto
[ 21%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-data.pb.cc.o
[ 21%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-operators-ml.pb.cc.o
[ 22%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o
[ 24%] Linking CXX static library libonnx_proto.a
[ 27%] Built target onnx_proto
Scanning dependencies of target onnx
[ 33%] Building CXX object CMakeFiles/onnx.dir/onnx/checker.cc.o
[ 33%] Building CXX object CMakeFiles/onnx.dir/onnx/common/ir_pb_converter.cc.o
[ 33%] Building CXX object CMakeFiles/onnx.dir/onnx/common/assertions.cc.o
[ 33%] Building CXX object CMakeFiles/onnx.dir/onnx/common/interned_strings.cc.o
[ 34%] Building CXX object CMakeFiles/onnx.dir/onnx/common/model_helpers.cc.o
[ 36%] Building CXX object CMakeFiles/onnx.dir/onnx/common/status.cc.o
[ 37%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/attr_proto_util.cc.o
[ 39%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/controlflow/defs.cc.o
[ 40%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/controlflow/old.cc.o
[ 42%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/data_type_utils.cc.o
[ 43%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/function.cc.o
[ 45%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/generator/defs.cc.o
[ 46%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/generator/old.cc.o
[ 48%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/logical/defs.cc.o
[ 50%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/logical/old.cc.o
[ 51%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/math/defs.cc.o
[ 53%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/math/old.cc.o
[ 54%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/nn/defs.cc.o
[ 56%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/nn/old.cc.o
[ 57%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/object_detection/defs.cc.o
[ 59%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/object_detection/old.cc.o
[ 60%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/quantization/defs.cc.o
[ 62%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/quantization/old.cc.o
[ 63%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/reduction/defs.cc.o
[ 65%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/reduction/old.cc.o
[ 66%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/rnn/defs.cc.o
[ 68%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/rnn/old.cc.o
[ 69%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/schema.cc.o
[ 71%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/sequence/defs.cc.o
[ 72%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor/defs.cc.o
[ 74%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor/old.cc.o
[ 75%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor/utils.cc.o
[ 77%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor_proto_util.cc.o
[ 78%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor_util.cc.o
[ 80%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/traditionalml/defs.cc.o
[ 81%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/traditionalml/old.cc.o
[ 83%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/training/defs.cc.o
[ 84%] Building CXX object CMakeFiles/onnx.dir/onnx/onnxifi_utils.cc.o
[ 86%] Building CXX object CMakeFiles/onnx.dir/onnx/optimizer/optimize.cc.o
[ 87%] Building CXX object CMakeFiles/onnx.dir/onnx/optimizer/pass.cc.o
[ 89%] Building CXX object CMakeFiles/onnx.dir/onnx/optimizer/pass_manager.cc.o
[ 90%] Building CXX object CMakeFiles/onnx.dir/onnx/optimizer/pass_registry.cc.o
[ 92%] Building CXX object CMakeFiles/onnx.dir/onnx/shape_inference/implementation.cc.o
[ 93%] Building CXX object CMakeFiles/onnx.dir/onnx/version_converter/convert.cc.o
[ 95%] Building CXX object CMakeFiles/onnx.dir/onnx/version_converter/helper.cc.o
[ 96%] Linking CXX static library libonnx.a
[ 96%] Built target onnx
Scanning dependencies of target onnx_cpp2py_export
[ 98%] Building CXX object CMakeFiles/onnx_cpp2py_export.dir/onnx/cpp2py_export.cc.o
In file included from /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/third_party/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/third_party/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/third_party/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/third_party/pybind11/include/pybind11/pybind11.h:45,
from /tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/onnx/cpp2py_export.cc:1:
/tmp/pip-install-4hcuagp3/onnx_b3380438a9fc4e2c8f80dae3fd60cfd7/third_party/pybind11/include/pybind11/detail/common.h:122:10: fatal error: Python.h: 没有那个文件或目录
#include <Python.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/onnx_cpp2py_export.dir/build.make:62: recipe for target 'CMakeFiles/onnx_cpp2py_export.dir/onnx/cpp2py_export.cc.o' failed
make[2]: *** [CMakeFiles/onnx_cpp2py_export.dir/onnx/cpp2py_export.cc.o] Error 1
CMakeFiles/Makefile2:349: recipe for target 'CMakeFiles/onnx_cpp2py_export.dir/all' failed
make[1]: *** [CMakeFiles/onnx_cpp2py_export.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
% (opt, underscore_opt))
Traceback (most recent call last):
File "/home/yaoz/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/yaoz/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/yaoz/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 205, in build_wheel
metadata_directory)
File "/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 217, in build_wheel
wheel_directory, config_settings)
File "/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 254, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 341, in <module>
'backend-test-tools = onnx.backend.test.cmd_tools:main',
File "/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-5bdpwz7b/overlay/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 217, in run
self.run_command('cmake_build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 211, in run
subprocess.check_call(build_args)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '--build', '.', '--', '-j', '4']' returned non-zero exit status 2.
----------------------------------------
ERROR: Failed building wheel for onnx
Failed to build onnx
ERROR: Could not build wheels for onnx which use PEP 517 and cannot be installed directly
错误原因:没有安装python3-dev
尝试输入命令安装:sudo apt-get install python3-dev
出现如下错误:
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:
下列软件包有未满足的依赖关系:
python3-dev : 依赖: python3 (= 3.6.5-3) 但是 3.6.7-1~18.04 正要被安装
依赖: libpython3-dev (= 3.6.5-3) 但是它将不会被安装
依赖: python3.6-dev (>= 3.6.5-2~) 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
解决办法:使用aptitude安装:sudo aptitude install python3-dev
如果没有安装aptitude则要先安装:sudo apt-get install aptitude
下列“新”软件包将被安装。
dh-python{a} libpython3-dev{a} libpython3.6-dev{ab} python3-dev{b} python3.6-dev{ab}
0 个软件包被升级,新安装 5 个, 0 个将被删除, 同时 0 个将不升级。
需要获取 2,886 kB 的存档。 解包后将要使用 16.8 MB。
下列软件包存在未满足的依赖关系:
python3-dev : 依赖: python3 (= 3.6.5-3) but 3.6.7-1~18.04 is installed
libpython3.6-dev : 依赖: libpython3.6-stdlib (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1 is installed
依赖: libpython3.6 (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1 is installed
python3.6-dev : 依赖: python3.6 (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1 is installed
依赖: libpython3.6 (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1 is installed
打开:42;关闭;591;defer: 26; 冲突;40 .下列动作将解决这些依赖关系:
保持 下列软件包于其当前版本:
1) libpython3-dev [未安装的]
2) libpython3.6-dev [未安装的]
3) python3-dev [未安装的]
4) python3.6-dev [未安装的]
是否接受该解决方案?[Y/n/q/?]
选择y
回车,会保持原来的状态。这里不能安装是因为官方源出问题,没有更新最新的python3-dev包。
我查过,官方主要服务器的python3-dev的最新版本仅支持python3.6.5版本的,然而我的jetson nano自带的是python3.6.9。如果使用aptitude强行降级安装的话,那么你的python3环境就会直接崩溃,你导入任何模块都会出现:非法指令(核心已转储)
的错误。所以在这里提醒一下大家。
我找到的解决办法是:切换国内的ubuntu源(淘宝店商家给的教程提示:切换国内源有风险,可能会出现其它不兼容的问题,但目前本人暂未发现后遗症):
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
切换之后更新一下软件源,然后就可以安装python3-dev了。
安装好之后,继续安装onnx:
~:pip3 install onnx==1.6.0
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting onnx==1.6.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/81/a9/a14c3bc32908c37b46b19a89eb6185b0c90fd9c03ef12379d51940b8fc71/onnx-1.6.0.t
Requirement already satisfied: protobuf in /home/yaoz/.local/lib/python3.6/site-packages (from onnx==1.6.0) (3.15.6)
Requirement already satisfied: numpy in /home/yaoz/.local/lib/python3.6/site-packages (from onnx==1.6.0) (1.16.1)
Requirement already satisfied: six in /home/yaoz/.local/lib/python3.6/site-packages (from onnx==1.6.0) (1.15.0)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /home/yaoz/.local/lib/python3.6/site-packages (from onnx==1.6.0) (3.7.4.3)
Building wheels for collected packages: onnx
Building wheel for onnx (setup.py) ... done
Created wheel for onnx: filename=onnx-1.6.0-cp36-cp36m-linux_aarch64.whl size=4203662 sha256=152b8bfe50f59264c41d7bd85a7d97710e955172297b9f3da68de98b329634e3
Stored in directory: /home/yaoz/.cache/pip/wheels/cc/b4/8e/7f4b6dabf5070e8c22bdbfe218048484b1cc0745ddf31020f4
Successfully built onnx
Installing collected packages: onnx
Successfully installed onnx-1.6.0
成功。