dusty-nv / jetson-inference

Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
https://developer.nvidia.com/embedded/twodaystoademo
MIT License
7.76k stars 2.97k forks source link

Error importing jetson-inference: "ImportError: libnvinfer.so.7: cannot open shared object file" #1371

Closed firststep-dev closed 1 year ago

firststep-dev commented 2 years ago

I have just upgraded Jetpack:

$ sudo apt show -a nvidia-jetpack
Package: nvidia-jetpack
Version: 4.6-b197
Priority: standard
Section: metapackages
Maintainer: NVIDIA Corporation
Installed-Size: 199 kB
Depends: nvidia-cuda (= 4.6-b197), nvidia-opencv (= 4.6-b197), nvidia-cudnn8 (= 4.6-b197), nvidia-tensorrt (= 4.6-b197), nvidia-visionworks (= 4.6-b197), nvidia-container (= 4.6-b197), nvidia-vpi (= 4.6-b197), nvidia-l4t-jetson-multimedia-api (>> 32.6-0), nvidia-l4t-jetson-multimedia-api (<< 32.7-0)
Homepage: http://developer.nvidia.com/jetson
Download-Size: 29.4 kB
APT-Sources: https://repo.download.nvidia.com/jetson/t194 r32.6/main arm64 Packages
Description: NVIDIA Jetpack Meta Package

I get the following error when I run: import jetson.inference.

Traceback (most recent call last):
  File "code/run_once/002_run_once_tf2.py", line 1, in <module>
    import utils;
  File "/home/firststep/firststep/code/run_once/utils.py", line 4, in <module>
    import sys; sys.path.insert(0, '/home/firststep/firststep/code/utils'); import firststep_utils as utils;
  File "/home/firststep/firststep/code/utils/firststep_utils.py", line 1, in <module>
    import jetson.inference
  File "/usr/lib/python3.6/dist-packages/jetson/inference/__init__.py", line 8, in <module>
    from jetson_inference_python import *
ImportError: libnvinfer.so.7: cannot open shared object file: No such file or directory

I didn't get this error before upgrading Jetpack.

System information (jtop):

image

What could be the issue here?

firststep-dev commented 2 years ago

It seems the the version of jetpack is different between:

sudo apt show -a nvidia-jetpack

and

jtop

firststep-dev commented 2 years ago

@dusty-nv - Might you have any idea how I can fix this and safely import jetson.inference?

dusty-nv commented 2 years ago

@firststep-dev re-build and re-install jetson-inference so that it recompiles against the new version of TensorRT/ect that you upgraded:

$ cd /path/to/your/jetson-inference
$ rm -rf build
$ mkdir build
$ cd build
$ cmake ../
$ make -j$(nproc)
$ sudo make install
firststep-dev commented 2 years ago

Thanks @dusty-nv that works well.