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

[Import Error] Unable to import tensorrt inside pytorch:2.1-r36.2.0 #472

Open
mzacri opened this issue Apr 10, 2024 · 3 comments
Open

[Import Error] Unable to import tensorrt inside pytorch:2.1-r36.2.0 #472

mzacri opened this issue Apr 10, 2024 · 3 comments

Comments

@mzacri
Copy link

mzacri commented Apr 10, 2024

Hi everyone,

I have installed the pytorch:2.1-r36.2.0 image and i'm having troubles importing tensorrt.

Error output

import tensorrt
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.10/dist-packages/tensorrt/init.py", line 67, in
from .tensorrt import *
ImportError: /usr/local/cuda/compat/libnvcudla.so: undefined symbol: _ZN5nvdla8IRuntime22registerTaskStatisticsE15NvDlaMemDescRec15NvDlaAccessType

Outside container env
Hardware: Jetson Orin 32GB Custom board
JetPack Release: 5.1 (R35.2.1)
TRT: TensorRT 8.5.2.2.1+cuda11.4
Torch: Torch 2.1.0a0+41361538.nv23.6

I have checked that libnvdla drivers are installed outside container:
-rw-r--r-- 1 root root 6978312 janv. 25 2023 /usr/lib/aarch64-linux-gnu/tegra/libnvdla_compiler.so
-rw-r--r-- 1 root root 404792 janv. 25 2023 /usr/lib/aarch64-linux-gnu/tegra/libnvdla_runtime.so

Any troubleshooting paths would be welcomed.

Thank you!

@dusty-nv
Copy link
Owner

Hi @mzacri, you are trying to run a container image for JetPack 6 (r36.2) on JetPack 5 (r35.2) - try running one of the r35 images instead

@johnnynunez
Copy link

You also can compile it:
I have scripts, but change your version and python version links
with python 3.11

export EXT_PATH=~/external
export TRT_OSSPATH=~/external/TensorRT

mkdir -p $EXT_PATH && cd $EXT_PATH
git clone https://github.com/pybind/pybind11.git

wget https://www.python.org/ftp/python/3.11.6/Python-3.11.6.tgz
tar -xvf Python-3.11.6.tgz
mkdir -p $EXT_PATH/python3.11/include
cp -r Python-3.11.6/Include/* $EXT_PATH/python3.11/include

wget https://deb.menhera.org/ubuntu-ports/pool/main/p/python3.11/libpython3.11-dev_3.11.6-3_arm64.deb
ar x libpython3.11-dev*.deb
mkdir debian && tar -xf data.tar.zst -C debian
cp debian/usr/include/aarch64-linux-gnu/python3.11/pyconfig.h python3.11/include/

git clone --branch release/8.6 --recursive https://github.com/NVIDIA/TensorRT.git
cd TensorRT
mkdir -p build && cd build
export TRT_LIBPATH=/usr/lib/aarch64-linux-gnu/
cmake .. -DTRT_LIB_DIR=$TRT_LIBPATH -DTRT_OUT_DIR=`pwd`/out -DTRT_PLATFORM_ID=aarch64 -DCUDA_VERSION=12.2 -DGPU_ARCHS="87"
CC=/usr/bin/gcc make -j$(nproc)

cd ../python
TENSORRT_MODULE=tensorrt PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=11 TARGET_ARCHITECTURE=aarch64 TRT_OSSPATH=~/external/TensorRT ./build.sh
pip install ./build/bindings_wheel/dist/tensorrt-*.whl

@mzacri
Copy link
Author

mzacri commented Apr 11, 2024

Hi @dusty-nv ,

I have tried a JP5 image and it works fine. Thanks !

@johnnynunez , i will try your method also when i'll have some time to dig further :). Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants