TensorRT: TypeError: pybind11::init(): factory function returned nullptr.

Hi,i am use tensorrt7.0.0.11 and cuda10.1 ubuntu16.04 pytorch1.3.1 python3.6.But i faced above problem when i was using it.It indices the problem from this line:

TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as 
 network, trt.OnnxParser(network,TRT_LOGGER) as parser:  #<--- this line got above problem.

The code can be use in the tensorrt6.0.1.5,but got problem in the tensorrt7.0.0.11.

What’s problem of my code?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25

Most upvoted comments

@rmccorm4,Hi,i have tried your suggestion, and i change my cuda10.1 to cuda10.0, but it still has such problem,the whole problem is: [TensorRT] ERROR: CUDA initialization failure with error 35. Please check your CUDA installation: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html Traceback (most recent call last): master/scripts/Pytorch2ONNX.py", line 53, in ONNX2Engine with trt.Builder(TRT_LOGGER) as builder: TypeError: pybind11::init(): factory function returned nullptr Can you help me? tkx.

Facing same issue with the the nvcr.io/nvidia/tensorrt:20.01-py2 container. If I run the container interactively, there is no issue.

I got this error while using the official tensorrt docker file from the nvidia container repository.

nvcr.io/nvidia/tensorrt:20.03-py3

So you guys did not fix it for over 2 years?

TypeError: pybind11::init(): factory function returned nullptr I encountered the same error, has anyone already solved this problem

TypeError: pybind11::init(): factory function returned nullptr I encountered the same error, has anyone already solved this problem

So where is the solution to it?

For all those facing this error with nvidia docker like nvcr.io/nvidia/tensorrt:20.01-py2 nvcr.io/nvidia/tensorrt:20.03-py3 try running the docker as nvidia-docker run instead of docker run. This solved the issue for me.

To the guys who are facing this issue in docker container, make sure -

  1. You have CUDA 10.2 with tensorRT 7+
  2. You have attached gpu to your container. --gpus all

Hi @chegnyanjun,

I don’t think there’s anything wrong with that code snippet, I use it all the time. However, I notice you’re using CUDA 10.1, and I believe TRT7 only supports 9.0, 10.0, and 10.2 per the support matrix: https://docs.nvidia.com/deeplearning/sdk/tensorrt-support-matrix/index.html

Please try again after changing to a supported CUDA version or use a container if you don’t want to change your host install