[Bug] Unable to build openvino for ubuntu 18.04, throws no match for ‘operator[]’
- OpenVINO=> 2021.4.752
- Operating System / Platform => Linux Ubuntu 18.04
- Compiler => :grey_question:
- Problem classification => :grey_question:
Detailed description
Previously Openvino used to work with Ubuntu 18.04, but very recently, It has stopped working, I was trying to build openvino for our application but it started failing with some reason. These are the errors which we didn't see earlier.
While performing make, initially it throwed error "Protobuf compiler not found", so i went ahead and installed apt-get install protobuf-compiler
Then again it started error Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR), now this time i installed apt-get install -y libprotobuf-dev
And then now it is throwing error
[ 43%] Building CXX object CMakeFiles/onnx.dir/onnx/shape_inference/implementation.cc.o
/tmp/pip-install-178o727p/onnx_6c6138ba506e4fd0b670c5471525c410/onnx/defs/sequence/defs.cc: In function ‘bool onnx::BuildSequenceMapBodyFunc(const onnx::FunctionBodyBuildContext&, const onnx::OpSchema&, onnx::FunctionProto&)’:
/tmp/pip-install-178o727p/onnx_6c6138ba506e4fd0b670c5471525c410/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());
^
/tmp/pip-install-178o727p/onnx_6c6138ba506e4fd0b670c5471525c410/onnx/defs/sequence/defs.cc:683:37: error: no match for ‘operator[]’ (operand types are ‘google::protobuf::RepeatedPtrField<onnx::ValueInfoProto>’ and ‘int’)
identity.add_output(g_inputs[inputIndex].name());
^
/tmp/pip-install-178o727p/onnx_6c6138ba506e4fd0b670c5471525c410/onnx/defs/sequence/defs.cc:741:30: error: no match for ‘operator[]’ (operand types are ‘google::protobuf::RepeatedPtrField<onnx::ValueInfoProto>’ and ‘int’)
int64_t dtype = g_outputs[outputIndex].type().tensor_type().elem_type();
^
[ 45%] Building CXX object CMakeFiles/onnx.dir/onnx/version_converter/convert.cc.o
CMakeFiles/onnx.dir/build.make:830: recipe for target 'CMakeFiles/onnx.dir/onnx/defs/sequence/defs.cc.o' failed
Steps to reproduce
- git clone https://github.com/gramineproject/examples/tree/master/openvino
- cd examples/openvino
- wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2021.4.2/l_openvino_toolkit_dev_ubuntu18_p_2021.4.752.tgz tar xzf l_openvino_toolkit_dev_ubuntu18_p_2021.4.752.tgz
- source l_openvino_toolkit_dev_ubuntu18_p_2021.4.752/bin/setupvars.sh
- make
Issue submission checklist
- [ Y] I report the issue, it's not a question
- [ Y] I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
- [Y ] There is reproducer code and related data files: images, videos, models, etc.
@anjalirai-intel
- Did you try to update before installing that? (sudo apt-get update)
- OpenVINO version 2021.4 is not the latest version. Are there any reasons that would restrict you from upgrading to the latest version? (2022.1)
@Iffa-Meah Yes, i have done apt update. Yes, right now we won't be able to upgrade it to 2022. But my biggest concern is openvino 2021 was working till last week and now suddenly we are facing setup issues.
Can you try to isolate your build environment into e.g. a Docker container or Python virtual-environment with specific, frozen versions of your example's dependencies (like using a "requirements.txt")? It looks like dependencies like ONNX or ProtoBuf have updated recently and braking your local build.
It is isolated. All these failures are within docker container. The requirements.txt is present in openvino setup
Ok... but in your Dockerfile you might call "sudo apt-get update", which will result in just the currently latest versions, which might change every minute. You might need to pin and freeze your dependencies to specific versions or keep them below a certain version.
But, this requirements.txt we need from openvino and i feel all the package details should be correctly mapped in openvino/install_dependencies/install_openvino_dependencies.sh
Having a list of packages to be installed automatically for the workload setup, in which setup is throwing error.
From your description it looked like you started to manually install missing components like apt-get install protobuf-compiler and apt-get install -y libprotobuf-dev.
Are you sure these dependencies are needed by OpenVINO itself of by your examples from git clone https://github.com/gramineproject/examples/tree/master/openvino?
As you just clone HEAD/LATEST revision - has the code changed since you built it successfully the last time?
(without tricks and without doing a clean docker-build the command "docker build" might not clone again, but might use an older local intermediate build layer)
I had to do manually because openvino failed in docker with error Protobuf compiler not found. To debug the issue further. I manually created the docker container and started debugging and that's why i installed those libraries.
Yes, These dependencies are needed by Openvino itself because i was still doing workload setup. If you want to verify it just go ahead and install onnx on Ubuntu 18.04 using python
The code has not changed. We can reproduce it without our application as well. Just install onnx using python
Installing OpenVINO requires to install dependencies via sudo -E /opt/intel/openvino_2021/install_dependencies/install_openvino_dependencies.sh, see "https://docs.openvino.ai/2021.4/openvino_docs_install_guides_installing_openvino_linux.html#step-2-install-external-software-dependencies".
Installing Model-Optimizer installs dependencies as well - like TensorFlow, like ONNX, see "https://docs.openvino.ai/2021.4/openvino_docs_install_guides_installing_openvino_linux.html#step-4-configure-the-model-optimizer", where you either install all supported framework's dependencies (sudo /opt/intel/openvino_2021/deployment_tools/model_optimizer/install_prerequisites/install_prerequisites.sh) or can choose to e.g. only install the ones for Model-Optimizer and ONNX via e.g. install_prerequisites_onnx.sh.
The samples and demos can be compiled like this successfully; the provided installation scripts take care about which dependency in which version and package to install.
@brmarkus I am facing issue in /opt/intel/openvino_2021/install_dependencies/install_openvino_dependencies.sh.
When the openvino is trying to install onnx, it fails there because protobuf and protobuf-compiler is dependency of latest onnx
Can you uninstall your previously, manually installed components mentioned above (including to remove them from APT-cache and/or PIP-cache) first and try again?
I did, that but with latest onnx version for ubuntu 18.04 bionic is not working. Do you know which onnx version is compatible for openvino 2021
You can have a look here, /opt/intel/openvino_2021.4.752/deployment_tools/model_optimizer/requirements_onnx.txt.
For my installed version 2021.4.752 (which is 2021.4.2) I can see this:
onnx>=1.8.1
networkx~=2.5
numpy>=1.16.6,<1.20
defusedxml>=0.7.1
requests>=2.25.1
In my Ubuntu 18.04 environment I got this ONNX installed:
$> pip list | grep -i onnx
onnx 1.10.2
So, with this onnx>=1.8.1 and with latest it is 1.12 and we have all this issue. I will try to stick with onnx version 1.8.1 for openvino 2021
I tried installing onnx with specific version and got this error
Collecting protobuf (from onnx==1.10.2) Downloading https://files.pythonhosted.org/packages/6c/be/4e32d02bf08b8f76bf6e59f2a531690c1e4264530404501f3489ca975d9a/protobuf-4.21.0-py2.py3-none-any.whl (164kB) [91mprotobuf requires Python '>=3.7' but the running Python is 3.6.9
Would it be possible to upgrade your Docker container from 18.04 to 20.04 (FROM ubuntu:20.04)? That would bring a newer Python and other newer package versions.
We have to test it with both 18.04 and 20.04. It's just a week ago 18.04 was also working for openvino. I want to go to that state
By any chance would you still have local container/images of that state, or pushed the container/image to a Docker hub (internal or public) - and then export the used version of that working state (calling pip freeze > requirements.txt)?
You might need to roll-back protobuf as well.
No, i don't have that container/images of that state now
I went through previous log files, and found that onnx version was protobuf-3.19.4 and onnx-1.11.0.
So, I installed them along libprotoc-dev, libprotobuf-dev , protobuf-compiler. I am getting this error openvino_ci_error.log