0

I tried to install onnx on my linux machine and encountered issue when I use python3 -m pip install onnxas

/tmp/pip-install-7ajubmjo/onnx_08cda1ef5f1d460ab7b455210cf3083e/onnx/defs/sequence/defs.cc: In function ‘bool onnx::BuildSequenceMapBodyFunc(const onnx::FunctionBodyBuildContext&, const onnx::OpSchema&, onnx::FunctionProto&)’:   /tmp/pip-install-7ajubmjo/onnx_08cda1ef5f1d460ab7b455210cf3083e/onnx/defs/sequence/defs.cc:675:40: error: no match for ‘operator[]’ (operand types are ‘google::protobuf::RepeatedPtrField<onnx::ValueInfoProto>’ and ‘int’)
           seq_at_node.add_output(g_inputs[inputIndex].name());
[ 95%] Building CXX object CMakeFiles/onnx.dir/onnx/version_converter/helper.cc.o
  CMakeFiles/onnx.dir/build.make:830: recipe for target 'CMakeFiles/onnx.dir/onnx/defs/sequence/defs.cc.o' failed

The protobuf was installed via sudo apt-get install protobuf-compiler libprotobuf-dev and my environment is:

- python=3.6
- ubuntu=18.04

Another related issue seems that the compilation cannot not find pybind11 as:

Generated: /tmp/pip-install-7ajubmjo/onnx_08cda1ef5f1d460ab7b455210cf3083e/.setuptools-cmake-build/onnx/onnx-ml.proto
    Generated: /tmp/pip-install-7ajubmjo/onnx_08cda1ef5f1d460ab7b455210cf3083e/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
    Generated: /tmp/pip-install-7ajubmjo/onnx_08cda1ef5f1d460ab7b455210cf3083e/.setuptools-cmake-build/onnx/onnx-data.proto
    -- Could NOT find pybind11 (missing: pybind11_DIR)
    -- pybind11 v2.9.1
    --
    -- ******** 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

even though it's already installed via pip install pybind11.

Any thoughts on how to move forward with this issue ?

exteral
  • 991
  • 2
  • 12
  • 33

1 Answers1

0

Upgrade you protobuf version seems the issue is with default Ubuntu 18.04 repo protobuf package.

simmilar issue was reported on opencv forum. github issue

Installation of protobuf 3.5.1 fixes this, maybe error in the original install process. I installed protobuf 3.5.1 from this release

Install steps

./autogen.sh
./configure
make
make install 
Devidas
  • 2,479
  • 9
  • 24