Can't access TensorRT from a python venv


I am creating a virtual environment in python. I can’t access TensorRT when the venv is activated.


TensorRT Version:
GPU Type: Xavier AGX
Nvidia Driver Version:
CUDA Version: 10.2
CUDNN Version: 8.0
Operating System + Version: L4T R32.5.0
Python Version (if applicable): 3.6.9

Steps To Reproduce


$ python3
>>> import tensorrt as rt
>>> print (rt.__version__)

I get as output.

I then create a virtual environment using:

$ python3.6 -m venv myenv

I activate the environment and then try to import TensorRT. I get a Module not found error.

Is there a simple way I could use TensorRT from inside the venv?


This looks like a Jetson issue. Please refer to the below samples in case useful.

For any further assistance, we will move this post to to Jetson related forum.


This is what I’ve tried:

$ export LD_LIBRARY_PATH=/usr/lib/python3.6/dist-packages/tensorrt:$LD_LIBRARY_PATH

but it didn’t work, I still get the error.

We recommend you to create virtual environment with --system-site-packages
Hope following similar posts may help you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.