megconvert源代码安装时遇到问题

在执行pip3 install . --user --install-option="–targets=onnx"命令时,遇到以下报错:
/home/fyh/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py:245: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
cmdoptions.check_install_build_global(options)
Processing /home/fyh/mgeconvert
Preparing metadata (setup.py) … done
Requirement already satisfied: numpy in /home/fyh/.local/lib/python3.8/site-packages (from mgeconvert==0.7.0.dev0) (1.21.4)
Skipping wheel build for mgeconvert, due to binaries being disabled for it.
Installing collected packages: mgeconvert
Running setup.py install for mgeconvert … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/home/fyh/mgeconvert/setup.py’"’"’; file=’"’"’/home/fyh/mgeconvert/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-w_muncmv/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/fyh/.local/include/python3.8/mgeconvert --targets=onnx
cwd: /home/fyh/mgeconvert/
Complete output (12 lines):
/home/fyh/.local/lib/python3.8/site-packages/setuptools/dist.py:493: UserWarning: Normalizing ‘0.7.0dev’ to ‘0.7.0.dev0’
warnings.warn(tmpl.format(**locals()))
running install
/home/fyh/.local/lib/python3.8/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 build
running build_py
copying mgeconvert/init.py -> build/lib.linux-x86_64-3.8/mgeconvert
running egg_info
writing manifest file ‘mgeconvert.egg-info/SOURCES.txt’
running build_ext
error: [Errno 13] Permission denied: ‘mgeconvert/backend/ir_to_onnx/init.sh’
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/home/fyh/mgeconvert/setup.py’"’"’; file=’"’"’/home/fyh/mgeconvert/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-w_muncmv/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/fyh/.local/include/python3.8/mgeconvert --targets=onnx Check the logs for full command output.

请问是什么问题?

看报错是表示在您的环境下,./mgeconvert/backend/ir_to_onnx/init.sh ,没有执行权限
1:请问这个 repo 你是怎么初始化的? 是否有跨OS的拷贝,导致文件权限丢失
帮忙执行一下, ls -l ./mgeconvert/backend/ir_to_onnx/init.sh 看看他有没有执行权限,类似应该是 -rwxrwxr-x
2:先手动给它加上权限吧, chmod +x ./mgeconvert/backend/ir_to_onnx/init.sh
然后再执行安装

谢谢,已经解决权限问题,但是执行后还有如下报错,请问是megconvert的版本问题吗?

WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Processing /home/fyh/mgeconvert
Preparing metadata (setup.py) … done
Requirement already satisfied: numpy in /home/fyh/.local/lib/python3.8/site-packages (from mgeconvert==0.7.0.dev0) (1.21.4)
Skipping wheel build for mgeconvert, due to binaries being disabled for it.
Installing collected packages: mgeconvert
Running setup.py install for mgeconvert … error
error: subprocess-exited-with-error

× Running setup.py install for mgeconvert did not run successfully.
│ exit code: 1
╰─> [129 lines of output]
/home/fyh/.local/lib/python3.8/site-packages/setuptools/dist.py:493: UserWarning: Normalizing ‘0.7.0dev’ to ‘0.7.0.dev0’
warnings.warn(tmpl.format(**locals()))
running install
/home/fyh/.local/lib/python3.8/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 build
running build_py
copying mgeconvert/init.py -> build/lib.linux-x86_64-3.8/mgeconvert
running egg_info
writing manifest file ‘mgeconvert.egg-info/SOURCES.txt’
running build_ext
Collecting onnx>=1.7.0
Using cached https://files.pythonhosted.org/packages/16/6a/bdae938babb4bc23de7b599439f3d1f1179748385e4ced099f3b4cb646bd/onnx-1.10.2.tar.gz
Requirement already satisfied: numpy>=1.16.6 in /home/fyh/.local/lib/python3.6/site-packages (from onnx>=1.7.0)
Requirement already satisfied: protobuf in /home/fyh/.local/lib/python3.6/site-packages (from onnx>=1.7.0)
Requirement already satisfied: six in /usr/lib/python3.6/site-packages (from onnx>=1.7.0)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /home/fyh/.local/lib/python3.6/site-packages (from onnx>=1.7.0)
Installing collected packages: onnx
Running setup.py install for onnx: started
Running setup.py install for onnx: finished with status ‘error’
Complete output from command /usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-0hp01yyd/onnx/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-ysk3o284-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
fatal: 不是一个 git 仓库(或者任何父目录):.git
running install
running build
running build_py
running create_version
running cmake_build
Using cmake args: [’/usr/local/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-x86_64-linux-gnu.so’, ‘-DCMAKE_BUILD_TYPE=Release’, ‘-DONNX_ML=1’, ‘/tmp/pip-build-0hp01yyd/onnx’]
– The C compiler identification is GNU 8.4.1
– The CXX compiler identification is GNU 8.4.1
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found PythonInterp: /usr/bin/python3 (found version “3.6.8”)
– Found PythonLibs: /usr/lib64/libpython2.7.so
Generated: /tmp/pip-build-0hp01yyd/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
CMake Error at CMakeLists.txt:295 (message):
Protobuf compiler not found
Call Stack (most recent call first):
CMakeLists.txt:326 (relative_protobuf_generate_cpp)

      -- Configuring incomplete, errors occurred!
      See also "/tmp/pip-build-0hp01yyd/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/tmp/pip-build-0hp01yyd/onnx/setup.py", line 361, in <module>
          'backend-test-tools = onnx.backend.test.cmd_tools:main',
        File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
          self.run_command(cmd)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
          return orig.install.run(self)
        File "/usr/lib64/python3.6/distutils/command/install.py", line 556, in run
          self.run_command('build')
        File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-0hp01yyd/onnx/setup.py", line 233, in run
          self.run_command('cmake_build')
        File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-0hp01yyd/onnx/setup.py", line 219, in run
          subprocess.check_call(cmake_args)
        File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/local/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-x86_64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/tmp/pip-build-0hp01yyd/onnx']' returned non-zero exit status 1.

      ----------------------------------------
  Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0hp01yyd/onnx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ysk3o284-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-0hp01yyd/onnx/
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/home/fyh/mgeconvert/setup.py", line 106, in <module>
      setup(
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 148, in setup
      return run_commands(dist)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
      dist.run_commands()
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/home/fyh/mgeconvert/setup.py", line 62, in run
      _install.run(self)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/command/install.py", line 68, in run
      return orig.install.run(self)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/command/install.py", line 664, in run
      self.run_command('build')
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/home/fyh/mgeconvert/setup.py", line 68, in run
      self.build_all(self.find_extension(target))
    File "/home/fyh/mgeconvert/setup.py", line 80, in build_all
      subprocess.check_call(ext.script)
    File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'mgeconvert/backend/ir_to_onnx/init.sh' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mgeconvert

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

关键 log: Protobuf compiler not found

try install by command: sudo apt-get install protobuf-compiler

谢谢,已成功安装protobuf-compiler:


但仍遇到以下问题,尝试解决失败,可以麻烦再帮忙看看吗?

WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Processing /home/fyh/mgeconvert
Preparing metadata (setup.py) … done
Requirement already satisfied: numpy in /home/fyh/.local/lib/python3.8/site-packages (from mgeconvert==0.7.0.dev0) (1.21.4)
Skipping wheel build for mgeconvert, due to binaries being disabled for it.
Installing collected packages: mgeconvert
Running setup.py install for mgeconvert … error
error: subprocess-exited-with-error
× Running setup.py install for mgeconvert did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
/home/fyh/.local/lib/python3.8/site-packages/setuptools/dist.py:493: UserWarning: Normalizing ‘0.7.0dev’ to ‘0.7.0.dev0’
warnings.warn(tmpl.format(**locals()))
invalid command name ‘–targets=onnx命令时,遇到以下报错’
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mgeconvert
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

没有看见 subprocess 的报错堆栈呢, 是不是 log 没有贴全?

我又运行了一下,这是截图:


和之前的log一样的,应该是全的了 :worried:

  • 出错地方: invalid command name ‘–targets=onnx
  • 正确的命令:
pip3 install . --user --install-option="--targets=onnx"
  • 你这边错误的命令:
pip3 install . --user --install-option="–targets=onnx"

注意观察 targets=onnx 前面的差异

谢谢,已经使用正确命令,但是仍未成功安装,报错信息较长,是否此处为关键问题:

CMake Error at /home/fyh/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
/home/fyh/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/home/fyh/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindProtobuf.cmake:650 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:175 (find_package)

如果是这里的问题请问如何解决呀?已经在网络上检索,没有类似的问题解决方法。

以下是完整报错:

WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Processing /home/fyh/mgeconvert
Preparing metadata (setup.py) … done
Requirement already satisfied: numpy in /home/fyh/.local/lib/python3.8/site-packages (from mgeconvert==0.7.0.dev0) (1.21.4)
Skipping wheel build for mgeconvert, due to binaries being disabled for it.
Installing collected packages: mgeconvert
Running setup.py install for mgeconvert … error
error: subprocess-exited-with-error

× Running setup.py install for mgeconvert did not run successfully.
│ exit code: 1
╰─> [131 lines of output]
/home/fyh/.local/lib/python3.8/site-packages/setuptools/dist.py:493: UserWarning: Normalizing ‘0.7.0dev’ to ‘0.7.0.dev0’
warnings.warn(tmpl.format(**locals()))
running install
/home/fyh/.local/lib/python3.8/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 build
running build_py
copying mgeconvert/init.py -> build/lib.linux-x86_64-3.8/mgeconvert
running egg_info
writing manifest file ‘mgeconvert.egg-info/SOURCES.txt’
running build_ext
Collecting onnx>=1.7.0
Using cached https://files.pythonhosted.org/packages/16/6a/bdae938babb4bc23de7b599439f3d1f1179748385e4ced099f3b4cb646bd/onnx-1.10.2.tar.gz
Requirement already satisfied: numpy>=1.16.6 in /home/fyh/.local/lib/python3.6/site-packages (from onnx>=1.7.0)
Requirement already satisfied: protobuf in /home/fyh/.local/lib/python3.6/site-packages (from onnx>=1.7.0)
Requirement already satisfied: six in /usr/lib/python3.6/site-packages (from onnx>=1.7.0)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /home/fyh/.local/lib/python3.6/site-packages (from onnx>=1.7.0)
Installing collected packages: onnx
Running setup.py install for onnx: started
Running setup.py install for onnx: finished with status ‘error’
Complete output from command /usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-d930bpc5/onnx/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-0qgny4fz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
fatal: 不是一个 git 仓库(或者任何父目录):.git
running install
running build
running build_py
running create_version
running cmake_build
Using cmake args: [’/home/fyh/.local/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-x86_64-linux-gnu.so’, ‘-DCMAKE_BUILD_TYPE=Release’, ‘-DONNX_ML=1’, ‘/tmp/pip-build-d930bpc5/onnx’]
– The C compiler identification is GNU 8.4.1
– The CXX compiler identification is GNU 8.4.1
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found PythonInterp: /usr/bin/python3 (found version “3.6.8”)
– Found PythonLibs: /usr/lib64/libpython2.7.so
CMake Error at /home/fyh/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
/home/fyh/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/home/fyh/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindProtobuf.cmake:650 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:175 (find_package)

      -- Configuring incomplete, errors occurred!
      See also "/tmp/pip-build-d930bpc5/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
      See also "/tmp/pip-build-d930bpc5/onnx/.setuptools-cmake-build/CMakeFiles/CMakeError.log".
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/tmp/pip-build-d930bpc5/onnx/setup.py", line 361, in <module>
          'backend-test-tools = onnx.backend.test.cmd_tools:main',
        File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
          self.run_command(cmd)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
          return orig.install.run(self)
        File "/usr/lib64/python3.6/distutils/command/install.py", line 556, in run
          self.run_command('build')
        File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-d930bpc5/onnx/setup.py", line 233, in run
          self.run_command('cmake_build')
        File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-d930bpc5/onnx/setup.py", line 219, in run
          subprocess.check_call(cmake_args)
        File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/home/fyh/.local/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-x86_64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/tmp/pip-build-d930bpc5/onnx']' returned non-zero exit status 1.

      ----------------------------------------
  Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d930bpc5/onnx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-0qgny4fz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-d930bpc5/onnx/
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/home/fyh/mgeconvert/setup.py", line 106, in <module>
      setup(
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 148, in setup
      return run_commands(dist)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
      dist.run_commands()
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/home/fyh/mgeconvert/setup.py", line 62, in run
      _install.run(self)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/command/install.py", line 68, in run
      return orig.install.run(self)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/command/install.py", line 664, in run
      self.run_command('build')
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/fyh/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/home/fyh/mgeconvert/setup.py", line 68, in run
      self.build_all(self.find_extension(target))
    File "/home/fyh/mgeconvert/setup.py", line 80, in build_all
      subprocess.check_call(ext.script)
    File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'mgeconvert/backend/ir_to_onnx/init.sh' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mgeconvert
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

  • megcovert 依赖 ONNX,现在报错是在装 onnx 的过程中失败的, 有因为onnx 依赖 protobuf,
    查了 pypi onnx 和 proobuf 在 python3.8 都有默认的repbuild binary 的呀, 感觉你的环境的python3 有点问题, 无法使用 prebuild 的whl包,才导致了 build onnx from src, 又因为你的 环境没有安装 protobuf 相关库,导致build onnx 失败了,

给几个方向:

  • sudo apt install libprotobuf-dev 看能不能解决你环境的问题
  • 尝试直接 pip3 install onnx 会报错吗?
  • 查一下你的python环境为啥不报 “Skipping wheel build for mgeconvert, due to binaries being disabled for it. ” 从而导致无法用 pypi prebuild 的onnx
  • 你的 linux 版本是多少? 执行 lsb_release -a 查看
1赞

嗯嗯好的,十分感谢!我先按照所给的几个建议尝试一下 :smiley: