I am trying to convert my .pb model to .onnx and for that I am installing tf2onnx using pip. However, doing that I keep getting following error
C:\Users\HC>pip install -U tf2onnx
Collecting tf2onnx
Using cached tf2onnx-1.9.3-py3-none-any.whl (435 kB)
Collecting flatbuffers~=1.12
Using cached flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: numpy>=1.14.1 in c:\users\hc\appdata\local\programs\python\python310\lib\site-packages (from tf2onnx) (1.22.1)
Requirement already satisfied: requests in c:\users\hc\appdata\local\programs\python\python310\lib\site-packages (from tf2onnx) (2.27.1)
Requirement already satisfied: six in c:\users\hc\appdata\local\programs\python\python310\lib\site-packages (from tf2onnx) (1.16.0)
Collecting onnx>=1.4.1
Using cached onnx-1.10.2.tar.gz (9.9 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
Traceback (most recent call last):
File "C:\Users\HC\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
main()
File "C:\Users\HC\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\HC\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 162, in get_requires_for_build_wheel
return self._get_build_requires(
File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 86, in <module>
assert CMAKE, 'Could not find "cmake" executable!'
AssertionError: Could not find "cmake" executable!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Please can anyone guide how to tackle this
CodePudding user response:
AssertionError: Could not find "cmake" executable!
indicates that pip couldn't find cmake. You should install it (https://cmake.org/download/) or add it to your PATH.
CodePudding user response:
As already stated, the problem is that cmake
is not installed. However, you can avoid this problem entirely by using Python 3.9 or 3.8. pip
can install pre-compiled onnx
for those python versions.