onnx error:
import onnx
Traceback (most recent call last):
File "torch2onnx.py", line 3, in
import onnx
File "/home/dy/anaconda3/envs/torch/lib/python3.6/site-packages/onnx/__init__.py", line 5, in
from .onnx_cpp2py_export import ONNX_ML
ImportError: /home/dy/anaconda3/envs/torch/lib/python3.6/site-packages/onnx/onnx_cpp2py_export.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN6google8protobuf7Message17CopyWithSizeCheckEPS1_RKS1_
Solution:
git clone https://github.com/onnx/onnx.git
cd onnx
git submodule update –init –recursive
# Optional: prefer lite proto
export CMAKE_ARGS=”-DONNX_USE_PROTOBUF_SHARED_LIBS=ON”
export CMAKE_ARGS=-DONNX_USE_LITE_PROTO=ON
pip install -e .