BLOG
Python

Using tensorrt in python virtual environment(venv, virtualenv) on jetson


April 19, 2024, 12:14 a.m.



In Jetson Jetpack environment, TensorRT is preinstalled and python wrapper is also installed.

But, If we use python venv, and tries to import tensorrt, the module is not found.

import tensorrt
File "<stdin>", line 1, in <module>
ImportError: No module named 'tensorrt'

In this situation, this problem is resolved by making symlink.

Solution

cd /venv/lib/python3.8/site-packages

ln -s /usr/lib/python3.8/dist-packages/tensorrt tensorrt

Done!

import tensorrt

tensorrt.__version__
'8.5.2.2'

Jetson tensorrt venv symlink



Search