Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onnx_backend_test.py libnvonnxparser.so.0: cannot open shared object file #43

Closed
myih opened this issue Aug 17, 2018 · 9 comments
Closed
Labels
question Further information is requested triaged Issue has been triaged by maintainers

Comments

@myih
Copy link

myih commented Aug 17, 2018

Hi

After I make the project, I encountered No module named '_nv_onnx_parser_bindings' error (same as 29)
so I import sys and sys.path.append('/home/onnx-tensorrt/build/lib.linux-x86_64-3.5/onnx_tensorrt/parser/'),
and now the new error is this

  File "onnx_backend_test.py", line 31, in <module>  import onnx_tensorrt.backend as trt
  File "/home/onnx-tensorrt/onnx_tensorrt/__init__.py", line 23, in <module>  from . import backend
  File "/home/onnx-tensorrt/onnx_tensorrt/backend.py", line 22, in <module>   from . import parser
  File "/home/onnx-tensorrt/onnx_tensorrt/parser/__init__.py", line 24, in <module>  from _nv_onnx_parser_bindings import *
ImportError: libnvonnxparser.so.0: cannot open shared object file: No such file or directory


The libnvonnxparser.so.0 is in onnx-tensorrt/build but I can't get the path to work.
Any advise? Thanks!

@Faldict
Copy link

Faldict commented Aug 20, 2018

Maybe you could add onnx-tensorrt/build to your LD_LIBRARY_PATH. Otherwise, try make install to automatically install the shared library.

@bpinaya
Copy link

bpinaya commented Nov 19, 2018

I've also encountered this error with TRT5.0.2GA when trying to run the tests (Also trying to build the TRT examples fails)
The test is python onnx_backend_test.py OnnxBackendRealModelTest
and the error is:

Traceback (most recent call last):
  File "onnx-tensorrt/onnx_backend_test.py", line 31, in <module>
    import onnx_tensorrt.backend as trt
  File "/home/bpinaya/Documents/gitrepos/onnx-tensorrt/onnx_tensorrt/__init__.py", line 23, in <module>
    from . import backend
  File "/home/bpinaya/Documents/gitrepos/onnx-tensorrt/onnx_tensorrt/backend.py", line 22, in <module>
    from . import parser
  File "/home/bpinaya/Documents/gitrepos/onnx-tensorrt/onnx_tensorrt/parser/__init__.py", line 23, in <module>
    from ._nv_onnx_parser_bindings import *
ImportError: No module named _nv_onnx_parser_bindings

@Faldict
Copy link

Faldict commented Nov 19, 2018

@bpinaya you should make sure that onnx-tensorrt is built successfully and included in the path correctly.

@bpinaya
Copy link

bpinaya commented Nov 19, 2018

Thanks for the reply @Faldict, do we have to add it to the python path or something? It did build successfully and I installed the libraries with sudo make install

@Faldict
Copy link

Faldict commented Nov 20, 2018

@bpinaya do you also install the python modules?
https://github.com/onnx/onnx-tensorrt#python-modules

@bpinaya
Copy link

bpinaya commented Nov 20, 2018

I have, this is the output of sudo python setup.py install

running install                                                                                                                                                                                               
running bdist_egg                                                                                                                                                                                             
running egg_info                                                                                                                                                                                              
writing requirements to onnx_tensorrt.egg-info/requires.txt                                                                                                                                                   
writing onnx_tensorrt.egg-info/PKG-INFO                                                                                                                                                                       
writing top-level names to onnx_tensorrt.egg-info/top_level.txt                                                                                                                                               
writing dependency_links to onnx_tensorrt.egg-info/dependency_links.txt                                                                                                                                       
reading manifest file 'onnx_tensorrt.egg-info/SOURCES.txt'                                                                                                                                                    
writing manifest file 'onnx_tensorrt.egg-info/SOURCES.txt'                                                                                                                                                    
installing library code to build/bdist.linux-x86_64/egg                                                                                                                                                       
running install_lib                                                                                                                                                                                           
running build_py                                                                                                                                                                                              
running build_ext                                                                                                                                                                                             
creating build/bdist.linux-x86_64/egg                                                                                                                                                                         
creating build/bdist.linux-x86_64/egg/onnx_tensorrt                                                                                                                                                           
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/tensorrt_engine.py -> build/bdist.linux-x86_64/egg/onnx_tensorrt                                                                                             
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/backend.py -> build/bdist.linux-x86_64/egg/onnx_tensorrt                                                                                                     
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/__init__.py -> build/bdist.linux-x86_64/egg/onnx_tensorrt                                                                                                    
creating build/bdist.linux-x86_64/egg/onnx_tensorrt/runtime                                                                                                                                                   
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/runtime/__init__.py -> build/bdist.linux-x86_64/egg/onnx_tensorrt/runtime                                                                                    
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/runtime/_nv_onnx_runtime_bindings.so -> build/bdist.linux-x86_64/egg/onnx_tensorrt/runtime                                                                   
creating build/bdist.linux-x86_64/egg/onnx_tensorrt/parser                                                                                                                                                    
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/parser/__init__.py -> build/bdist.linux-x86_64/egg/onnx_tensorrt/parser                                                                                      
copying build/lib.linux-x86_64-2.7/onnx_tensorrt/parser/_nv_onnx_parser_bindings.so -> build/bdist.linux-x86_64/egg/onnx_tensorrt/parser                                                                      
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/tensorrt_engine.py to tensorrt_engine.pyc                                                                                                           
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/backend.py to backend.pyc                                                                                                                           
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/__init__.py to __init__.pyc                                                                                                                         
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/runtime/__init__.py to __init__.pyc                                                                                                                 
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/parser/__init__.py to __init__.pyc                                                                                                                  
creating stub loader for onnx_tensorrt/parser/_nv_onnx_parser_bindings.so                                                                                                                                     
creating stub loader for onnx_tensorrt/runtime/_nv_onnx_runtime_bindings.so                                                                                                                                   
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/parser/_nv_onnx_parser_bindings.py to _nv_onnx_parser_bindings.pyc                                                                                  
byte-compiling build/bdist.linux-x86_64/egg/onnx_tensorrt/runtime/_nv_onnx_runtime_bindings.py to _nv_onnx_runtime_bindings.pyc                                                                               
creating build/bdist.linux-x86_64/egg/EGG-INFO                                                                                                                                                                
copying onnx_tensorrt.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO                                                                                                                              
copying onnx_tensorrt.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO                                                                                                                           
copying onnx_tensorrt.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO                                                                                                                  
copying onnx_tensorrt.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO                                                                                                                          
copying onnx_tensorrt.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO                                                                                                                         
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt                                                                                                                                                 
zip_safe flag not set; analyzing archive contents...                                                                                                                                                          
creating 'dist/onnx_tensorrt-0.1.0-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it                                                                                                    
removing 'build/bdist.linux-x86_64/egg' (and everything under it)                                                                                                                                             
Processing onnx_tensorrt-0.1.0-py2.7-linux-x86_64.egg                                                                                                                                                         
Removing /usr/local/lib/python2.7/dist-packages/onnx_tensorrt-0.1.0-py2.7-linux-x86_64.egg                                                                                                                    
Copying onnx_tensorrt-0.1.0-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages                                                                                                                  
onnx-tensorrt 0.1.0 is already the active version in easy-install.pth                                                                                                                                         
                                                                                                                                                                                                              
Installed /usr/local/lib/python2.7/dist-packages/onnx_tensorrt-0.1.0-py2.7-linux-x86_64.egg                                                                                                                   
Processing dependencies for onnx-tensorrt==0.1.0                                                                                                                                                              
Searching for pycuda==2018.1                                                                                                                                                                                  
Best match: pycuda 2018.1                                                                                                                                                                                     
Adding pycuda 2018.1 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages                                                                                                                                                        
Searching for onnx==1.3.0                                                                                                                                                                                     
Best match: onnx 1.3.0                                                                                                                                                                                        
Processing onnx-1.3.0-py2.7-linux-x86_64.egg                                                                                                                                                                  
onnx 1.3.0 is already the active version in easy-install.pth                                                                                                                                                  
Installing check-node script to /usr/local/bin                                                                                                                                                                
Installing backend-test-tools script to /usr/local/bin                                                                                                                                                        
Installing check-model script to /usr/local/bin                                                                                                                                                               
                                                                                                                                                                                                              
Using /usr/local/lib/python2.7/dist-packages/onnx-1.3.0-py2.7-linux-x86_64.egg                                                                                                                                
Searching for tensorrt==5.0.2.6                                                                                                                                                                               
Best match: tensorrt 5.0.2.6                                                                                                                                                                                  
Adding tensorrt 5.0.2.6 to easy-install.pth file                                                                                                                                                              
                                                                                                                                                                                                              
Using /usr/lib/python2.7/dist-packages                                                                                                                                                                        
Searching for numpy==1.15.0                                                                                                                                                                                   
Best match: numpy 1.15.0                                                                                                                                                                                      
Adding numpy 1.15.0 to easy-install.pth file                                                                                                                                                                  
Installing conv-template script to /usr/local/bin                                                                                                                                                             
Installing from-template script to /usr/local/bin                                                                                                                                                             
Installing f2py script to /usr/local/bin                                                                                                                                                                      
                                                                                                                                                                                                              
Using /home/bpinaya/.local/lib/python2.7/site-packages                                                                                                                                                        
Searching for appdirs==1.4.3                                                                                                                                                                                  
Best match: appdirs 1.4.3                                                                                                                                                                                     
Adding appdirs 1.4.3 to easy-install.pth file                                                                                                                                                                 
                                                                                                                                                                                                              
Using /home/bpinaya/.local/lib/python2.7/site-packages                                                                                                                                                        
Searching for pytest==3.7.1                                                                                                                                                                                   
Best match: pytest 3.7.1                                                                                                                                                                                      
Adding pytest 3.7.1 to easy-install.pth file                                                                                                                                                                  
Installing pytest script to /usr/local/bin                                                                                                                                                                    
Installing py.test script to /usr/local/bin

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for pytools==2018.5.2
Best match: pytools 2018.5.2
Adding pytools 2018.5.2 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for decorator==4.3.0
Best match: decorator 4.3.0
Adding decorator 4.3.0 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages                                                                                                                                                                  
Searching for Mako==1.0.7                                                                                                                                                                                     
Best match: Mako 1.0.7                                                                                                                                                                                        
Adding Mako 1.0.7 to easy-install.pth file                                                                                                                                                                    
Installing mako-render script to /usr/local/bin                                                                                                                                                               
                                                                                                                                                                                                              
Using /home/bpinaya/.local/lib/python2.7/site-packages                                                                                                                                                        
Searching for typing==3.6.6                                                                                                                                                                                   
Best match: typing 3.6.6                                                                                                                                                                                      
Processing typing-3.6.6-py2.7.egg                                                                                                                                                                             
typing 3.6.6 is already the active version in easy-install.pth                                                                                                                                                

Using /usr/local/lib/python2.7/dist-packages/typing-3.6.6-py2.7.egg
Searching for typing-extensions==3.6.6
Best match: typing-extensions 3.6.6
Processing typing_extensions-3.6.6-py2.7.egg
typing-extensions 3.6.6 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/typing_extensions-3.6.6-py2.7.egg
Searching for six==1.11.0
Best match: six 1.11.0
Adding six 1.11.0 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for protobuf==3.2.0
Best match: protobuf 3.2.0
Adding protobuf 3.2.0 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for funcsigs==1.0.2
Best match: funcsigs 1.0.2
Adding funcsigs 1.0.2 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for attrs==18.1.0
Best match: attrs 18.1.0
Adding attrs 18.1.0 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for more-itertools==4.3.0
Best match: more-itertools 4.3.0
Adding more-itertools 4.3.0 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for pathlib2==2.3.2
Best match: pathlib2 2.3.2
Adding pathlib2 2.3.2 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for setuptools==40.0.0
Best match: setuptools 40.0.0
Adding setuptools 40.0.0 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-3.6 script to /usr/local/bin

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for pluggy==0.7.1
Best match: pluggy 0.7.1
Adding pluggy 0.7.1 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for py==1.5.4
Best match: py 1.5.4
Adding py 1.5.4 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for atomicwrites==1.1.5
Best match: atomicwrites 1.1.5
Adding atomicwrites 1.1.5 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Searching for MarkupSafe==1.0
Best match: MarkupSafe 1.0
Adding MarkupSafe 1.0 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Searching for scandir==1.8
Best match: scandir 1.8
Adding scandir 1.8 to easy-install.pth file

Using /home/bpinaya/.local/lib/python2.7/site-packages
Finished processing dependencies for onnx-tensorrt==0.1.0

But the error persists still, even from the C api, I was trying to build some onnx samples with cpp api (sampleOnnxMNIST) from tensorrt samples I get:

../Makefile.config:5: CUDA_INSTALL_DIR variable is not specified, using /usr/local/cuda by default, use CUDA_INSTALL_DIR=<cuda_directory> to change.
../Makefile.config:8: CUDNN_INSTALL_DIR variable is not specified, using $CUDA_INSTALL_DIR by default, use CUDNN_INSTALL_DIR=<cudnn_directory> to change.
:
Compiling: sampleOnnxMNIST.cpp
sampleOnnxMNIST.cpp: In function ‘void onnxToTRTModel(const string&, unsigned int, nvinfer1::IHostMemory*&)’:
sampleOnnxMNIST.cpp:45:63: error: cannot convert ‘nvinfer1::INetworkDefinition’ to ‘nvinfer1::INetworkDefinition*’ for argument ‘1’ to ‘nvonnxparser::IParser* nvonnxparser::{anonymous}::createParser(nvinfer1::INetworkDefinition*, nvinfer1::ILogger&)’
     auto parser = nvonnxparser::createParser(*network, gLogger);
                                                               ^
../Makefile.config:172: recipe for target '../../bin/dchobj/sampleOnnxMNIST.o' failed
make: *** [../../bin/dchobj/sampleOnnxMNIST.o] Error 1

So I really ran out of ideas. Doing it on a fresh install of my OS was my last option but I'm thinking about that.
Did you get it to run? Mind sharing the versions you use? (python, trt, onnx, cuda, cudnn)?

@Faldict
Copy link

Faldict commented Nov 20, 2018

@bpinaya I don't know what happened due to the uninformative logs. You can find my versions here:
#35 (comment)

@kevinch-nv
Copy link
Collaborator

Apologies, we had some uninformative installation instructions for previous versions of TensorRT. Have you tried using the latest version of TensorRT (7.2.1) available on the master branch and following the build instructions there?

@kevinch-nv kevinch-nv added question Further information is requested triaged Issue has been triaged by maintainers labels Oct 25, 2020
@kevinch-nv
Copy link
Collaborator

Closing due to inactivity - if you are still having issues with the latest version of onnx-tensorrt feel free to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

4 participants