Deepstream 6.2 and torch/torchvision issue: "UserWarning: Failed to load image Python extension:"

• DeepStream 6.2
**• JetPack Version 5, I think, **
• Tegra: 35 (release), REVISION: 3.1, GCID: 32827747, BOARD: t186ref, EABI: aarch64, DATE: Sun Mar 19 15:19:21 UTC 2023
• TensorRT Version: 8.5.2-1+cuda11.4

• Issue Type( questions, new requirements, bugs)
I get “UserWarning: Failed to load image Python extension:”

**• How to reproduce the issue ? I just run:

import torch
import torchvision as so

/home/aiadmin/.local/lib/python3.8/site-packages/torchvision/io/ UserWarning: Failed to load image Python extension:
warn(f"Failed to load image Python extension: {e}")

I have upgraded/downgraded torch and torchvision using the following versions:

torch: 1.13.0, vision: 0.14.0
torch: 1.9.0, vision: 0.10.0
torch 1.13.1, vision: 0.14.1

If I use 1.9.0 for pytorch and 0.10.0 for torchvision it works. But I then get other errors for

raise ValueError("Unsupported ONNX opset version: " + str(opset_version))

So I think I then have issues with ONNX does not work with pytorch and torchvision. I have tried to work also with different versions of ONNX, but that does not work. I guess I need to change opset_version but dont know how and if its recommended for conversion using Deepstream-Yolo by Marcos Lucianops.

The reason I do all this is to convert my yoloV8 model from a pt file to onnx format. I run the pt file with the ultralytics prediction and it works but when I want to use deepstream, this is where it does not work. It seems the conversion of the file does not work!


Could you try if there is the same warning with the environment of our docker:



I made it work. After alot of back and forth I decided to upgrade Pytorch and Torchvision to the latest. Then it worked. I dont know which version of protobuf I have, but I think 4.20 somthing. I will post my version here because these things are extremely sensitive. Perhaps someone else can get it working too… Coming soon…

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