question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pip install onnx failed

See original GitHub issue

Bug Report

Is the issue related to model conversion?

No

Describe the bug

When install onnx by:

sudo apt-get install protobuf-compiler libprotoc-dev
pip install git+https://github.com/onnx/onnx.git

get error:

  /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libprotobuf.a(arena.o): relocation R_X86_64_TPOFF32 against hidden symbol `_ZN6google8protobuf8internal9ArenaImpl13thread_cache_E' can not be used when making a shared object
  /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libprotobuf.a(common.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

Error log link (in mlflow CI): https://github.com/mlflow/mlflow/pull/4545/checks?check_run_id=3026228796#step:9:303

System information

  • OS Platform and Distribution (e.g. Linux Ubuntu 16.04): Ubuntu 20.04.2 LTS
  • ONNX version (e.g. 1.7): github master version
  • Python version: CPython (3.6.13)
  • GCC/Compiler version (if compiling from source): The C compiler identification is GNU 9.3.0, The CXX compiler identification is GNU 9.3.0
  • CMake version: 3.20.5
  • Protobuf version: 3.17.3, libprotobuf.a;-lpthread (version “3.6.1”)
  • Visual Studio version (if applicable):

Reproduction instructions

  • Describe the code to reproduce the behavior. Bash code
sudo apt-get install protobuf-compiler libprotoc-dev
pip install git+https://github.com/onnx/onnx.git
  • Attach the ONNX model to the issue (where applicable)

Expected behavior

A clear and concise description of what you expected to happen.

Notes

Any additional information

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

16reactions
snnncommented, Jul 23, 2021

@WeichenXu123 back to your original question,

Instead of running

sudo apt-get install protobuf-compiler libprotoc-dev

You should run

 apt-get install libprotobuf-dev protobuf-compiler

Then, most important

export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
6reactions
Inquisitive-MEcommented, Apr 30, 2022

It fails to build for me on Ubuntu 22.04. But I ran export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON" and it built

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to install onnx via pip · Issue #2734 - GitHub
Looks like you're using python 3.8, which is currently unsupported. Can you try with python 3.7? All reactions.
Read more >
Errors when installing onnx with pip in Ubuntu 20.04
I'm trying to install onnx in a fresh Ubuntu 20.04 install, but I'm running into the error bellow. It seems that I need...
Read more >
ERROR: Could not build wheels for onnx in Python | bobbyhadz
To solve the error "Could not build wheels for onnx", run the pip install --upgrade pip command to upgrade your pip version and...
Read more >
error: could not build wheels for onnx, which is required to ...
pip install -e . will fail due to missing .pyd file (FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\jacky\AppData\Local\Temp\tmpba9gls20 ...
Read more >
onnx - PyPI
Official Python packages. ONNX released packages are published in PyPi. pip install onnx. Weekly packages are published in test pypi to enable experimentation ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found