I have TensorRT installed on my system (v7.1.3.1). It is a Jetson NX with Python 3.6, running Cuda 10.2. I have found reference to the fact that the Python API for tensorRT did not support Jetson systems in other forum posts.
Should I expect the Python API to be supported on this platform?
I am asking as I am having trouble importing TensorRT into Python in my venv.
TensorRT python already supports the Jetson platform.
Would you mind sharing the error you met with us?
Currently, the python package was built with default python 3.6.
If you are trying to use another python version, please build it with the pybinding source below:
Essentially I get errors importing the tensorRT module in both my base environments and venv. I have the Python binding libraries installed as shown from the output of dpkg -l | grep nvinfer:
ii libnvinfer-bin 7.1.3-1+cuda10.2 arm64 TensorRT binaries
ii libnvinfer-dev 7.1.3-1+cuda10.2 arm64 TensorRT development libraries and headers
ii libnvinfer-doc 7.1.3-1+cuda10.2 all TensorRT documentation
ii libnvinfer-plugin-dev 7.1.3-1+cuda10.2 arm64 TensorRT plugin libraries
ii libnvinfer-plugin7 7.1.3-1+cuda10.2 arm64 TensorRT plugin libraries
ii libnvinfer-samples 7.1.3-1+cuda10.2 all TensorRT samples
ii libnvinfer7 7.1.3-1+cuda10.2 arm64 TensorRT runtime libraries
ii python-libnvinfer 7.1.3-1+cuda10.2 arm64 Python bindings for TensorRT
ii python-libnvinfer-dev 7.1.3-1+cuda10.2 arm64 Python development package for TensorRT
ii python3-libnvinfer 7.1.3-1+cuda10.2 arm64 Python 3 bindings for TensorRT
ii python3-libnvinfer-dev 7.1.3-1+cuda10.2 arm64 Python 3 development package for TensorRT
TensorRT is also definitely functioning since I can use trtexec in the samples to run inference and engine building tests on the machine.
However when I try and import in python I get the following error:
import tensorrt as trt
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘tensorrt’
I have tried changing my $PATH variables to incorporate where the tensorrt libraries should be. This has not changed anything. I noticed that the library files were missing from the equivalent install location on another (non jetson) machine.
$ ls -1 /usr/lib/python3.6/dist-packages/
cv2
graphsurgeon
graphsurgeon-0.4.5.dist-info
uff
uff-0.6.9.dist-info
I would perhaps expect to find TensorRT here. This led me to think I might have to install with apt to get the python API libraries but when I try and run the apt or pip installation as shown in the TensorRT installation guide I get the error mentioned in the install document:
RuntimeError:
###########################################################################################
The package you are trying to install is only a placeholder project on PyPI.org repository.
This package is hosted on NVIDIA Python Package Index.
Only taking the recommended action does not produce any change in behaviour. I also have pycuda etc installed and have followed other advice I have found to fix the problem. The lack of change led me to suspect that maybe I couldnt access to Python API on a Jetson NX. It is good news that this is meant to work. Hopefully we can figure out what needs to change in my case.
I flashed a separate SD card and gave it a go with a new version of the jetpack and it was installed correctly.
Looks like something went wrong with my previous Jetpack installation. (Or I somehow removed the package during usage and could no longer find a compatible install?)
Not sure exactly but at least I can use it on this alternative boot. Will mark as solution.