onnx / onnx/optimizer

Need more explicit instruction on installing the Protobuf and ONNX optimizer.

Open
#49 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
834
Forks
109
Avg merge
6h 55m
Merged PRs (30d)
2

Description

Hi,

I tried installinig the Protobuf via both building from source and apt. When I tried to build ONNX optimizer from source, I got problems related to Protobuf. How do I specify Protobuf for installing ONNX optimizer? Thank you.

root@3235dac98ab6:/mnt# pip install -e .
Obtaining file:///mnt
Requirement already satisfied: onnx in /tmp/onnx (from onnxoptimizer==0.2.6) (1.9.0)
Requirement already satisfied: protobuf in /usr/local/lib/python3.8/dist-packages (from onnx->onnxoptimizer==0.2.6) (3.17.3)
Requirement already satisfied: numpy>=1.16.6 in /usr/local/lib/python3.8/dist-packages (from onnx->onnxoptimizer==0.2.6) (1.21.0)
Requirement already satisfied: six in /usr/local/lib/python3.8/dist-packages (from onnx->onnxoptimizer==0.2.6) (1.16.0)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /usr/local/lib/python3.8/dist-packages (from onnx->onnxoptimizer==0.2.6) (3.10.0.0)
Installing collected packages: onnxoptimizer
  Running setup.py develop for onnxoptimizer
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/mnt/setup.py'"'"'; __file__='"'"'/mnt/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'"'"'))' develop --no-deps
         cwd: /mnt/
    Complete output (105 lines):
    running develop
    running build_py
    running create_version
    running cmake_build
    CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:469 (file):
      file STRINGS file "/opt/conda/include/google/protobuf/stubs/common.h"
      cannot be read.
    Call Stack (most recent call first):
      third_party/onnx/CMakeLists.txt:172 (find_package)
    
    
    CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:475 (math):
      math cannot parse the expression: " / 1000000": syntax error, unexpected
      exp_DIVIDE (2).
    Call Stack (most recent call first):
      third_party/onnx/CMakeLists.txt:172 (find_package)
    
    
    CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:476 (math):
      math cannot parse the expression: " / 1000 % 1000": syntax error,
      unexpected exp_DIVIDE (2).
    Call Stack (most recent call first):
      third_party/onnx/CMakeLists.txt:172 (find_package)
    
    
    CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:477 (math):
      math cannot parse the expression: " % 1000": syntax error, unexpected
      exp_MOD (2).
    Call Stack (most recent call first):
      third_party/onnx/CMakeLists.txt:172 (find_package)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review setup.py and the failure at third_party/onnx/CMakeLists.txt:172, where CMake's FindProtobuf.cmake looks under /opt/conda/include. Reproduce the setup.py develop command and document how users should install or point to Protobuf for ONNX optimizer. Done means a clean reader can follow the instructions without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.