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

Install tenosrrt for python3.8 in Jetson Xavier NX #6

Open
zhr01 opened this issue Oct 29, 2021 · 9 comments
Open

Install tenosrrt for python3.8 in Jetson Xavier NX #6

zhr01 opened this issue Oct 29, 2021 · 9 comments

Comments

@zhr01
Copy link

zhr01 commented Oct 29, 2021

I try to achive the result in Nvidia Jetson Xavier NX. After setup up the environment, I got the fllowing error message:

Makefile:236: *** MLPerf Inference v1.1 code requires NVIDIA Driver Version >= 465.xx.  Stop

then I check the environment, found the tensorrt not in my python3.8 env, so how can I install tensorrt for python3.8

@zhr01 zhr01 changed the title tenosrrt for python3.8 in Jetson Xavier NX Install tenosrrt for python3.8 in Jetson Xavier NX Oct 29, 2021
@nvitramble
Copy link

Could you share the commands you've run so far, as well as the output of running python3 scripts/get_system_id.py from the closed/NVIDIA directory? Thanks

@yzh89
Copy link

yzh89 commented Nov 16, 2021

The python3-libnvinfer only works with python3.6. There are some discussion here: https://forums.developer.nvidia.com/t/python-binding-not-found-for-tensorrt/76408.

It looks like the python3.8 binding needed to created with manual binding

@Treemann
Copy link

Hi @zhr01 , have you solved the problem?

I followed the instruction to set up the environment for testing on Jetson AGX Xavier, everything went fine for running the script install_xavier_dependencies.sh, but when I ran the script for data preprocessing, error occurred that:
No module named 'tensorrt'

I noticed that in 'install_xavier_dependencies.sh' python3.8 was installed and set as the default version of python3, but python3.8 could not import 'tensorrt'. I tried to "import tensorrt" with python3.6 and no error occurred.

So @nvitramble , do I miss something in the official instruction? Should I manually compile & build the .whl for using tensorrt with python3.8?

What's more, I check the instruction of build the python binding, and find that I can not find the 'PyConfig.h' file for python3.8 (on aarch64) according to the link NVIDIA provided in this section 'Add PyConfig.h'. How can I build the binding for python3.8?

@psyhtest
Copy link

@Treemann It looks like we are banging our heads against the same wall and at the same time!

FWIW, I've tried to take pyconfig.h from a non-architecture specific python3.8 package and an aarch-specific python3.9 package, but nothing's worked.

/cc @nvpohanh @DilipSequeira

@Treemann
Copy link

Treemann commented May 18, 2022

Hi @psyhtest I could find the 'PyConfig.h' on the location where Python3.8 was installed. I built the 'python binding' for Python3.8 successfully and finally could run the script for testing. (FYI: I tried with the code for MLPerf v1.1)

@psyhtest
Copy link

@Treemann, that's great to hear! I was beginning to suspect that something else was wrong. I'll give it another try.

@psyhtest
Copy link

@yzh89 Please try these instructions (copying and pasting the whole block should work).

@wangxudong-cq
Copy link

@psyhtest well done. But followed by a segfault on "reate_network" as blow:
script

import numpy as np

def pyBuilder(framework):
    if framework=="trt":
        import tensorrt as rt
        logger=rt.Logger(rt.Logger.WARNING)
    
    with rt.Builder(logger) as builder:
        print("--------------------------------------")
        with builder.create_network(1 << int(rt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)) as network:
            print("--------------------------------------")
            INPUT_NAME="input"
            INPUT_SHAPE=(3,5,5)
            input_tensor = network.add_input(name=INPUT_NAME, dtype=rt.float32, shape=INPUT_SHAPE)
            conv1_w = np.random.random(size=(3,3,5))
            conv1_w.dtype = "float32"
            conv1_b = np.random.random(size=(3))
            conv1_b.dtype = "float32"
            conv1 = network.add_convolution(input=input_tensor, num_output_maps=20, kernel_shape=(5, 5), kernel=conv1_w, bias=conv1_b)
            conv1.stride = (1, 1)
            print(type(conv1))
            print(dir(conv1))
            print(conv1.kernel_size)
            conv1.kernel_size=(7,7)
            print(conv1.kernel_size)
            print(conv1.num_output_maps)
            print(conv1.stride)
            print(conv1.padding)
            print(conv1.num_output_maps)
            print(conv1.num_groups)
            conv1.num_groups=21
            print(conv1.get_input(0))
            print(dir(conv1.get_input(0)))
            print(conv1.get_input(1))
            print(conv1.get_input(-1))

pyBuilder("trt")

output

load lib: /usr/local/lib/python3.8/dist-packages/tensorrt/tensorrt.so
8.2.5.1
--------------------------------------
Segmentation fault

@wangxudong-cq
Copy link

May caused by the mismatch between tensorrt python API and tensorrt.so?

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

6 participants