How can i solve pytorch import in DeepStream 5.1(docker)

• Hardware Platform (Jetson / GPU) RTX 3070
• DeepStream Version 5.1 ( docker triton 02.26.2021 version)
• JetPack Version (valid for Jetson only) no
• TensorRT Version 7.2.1 , 7.2.2
• NVIDIA GPU Driver Version (valid for GPU only) 460.39

Please answer quickly. :)

I have deepstream 5.1 docker image, sample version and triton version.

I installed it inside container to use pytorch.

but trition container was not import pytorch

  • error code
    Python 3.6.9 (default, Oct 8 2020, 12:12:24)
    [GCC 8.4.0] on linux
    Type “help”, “copyright”, “credits” or “license” for more information.

    import torch
    Traceback (most recent call last):
    File “”, line 1, in
    File “/usr/local/lib/python3.6/dist-packages/torch/init.py”, line 190, in
    from torch._C import *
    ImportError: /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch_python.so: undefined symbol:
    _ZTIN5torch11distributed3rpc8RpcAgentE

  • pip3 list
    root@d1ae1024f8b6:/opt/nvidia/deepstream/deepstream-5.1# pip3 list
    Package Version
    dataclasses 0.8
    graphsurgeon 0.4.5
    grpcio 1.33.2
    grpcio-channelz 1.33.2
    grpcio-tools 1.33.2
    numpy 1.19.4
    Pillow 8.1.1
    pip 21.0.1
    protobuf 3.13.0
    setuptools 50.3.2
    six 1.15.0
    tensorrt 7.2.1.6
    torch 1.7.1+cu110
    torchaudio 0.7.2
    torchvision 0.8.2+cu110
    typing-extensions 3.7.4.3
    uff 0.6.9
    wheel 0.35.1

BUT!
sample version is good worked ^^;;

  • code
    Python 3.6.9 (default, Jan 26 2021, 15:33:00)
    [GCC 8.4.0] on linux
    Type “help”, “copyright”, “credits” or “license” for more information.

    import torch

  • pip3 list
    root@a4c597aa8bd1:/# pip3 list
    DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or
    define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
    asn1crypto (0.24.0)
    cryptography (2.1.4)
    Cython (0.29.22)
    dataclasses (0.8)
    graphsurgeon (0.4.5)
    idna (2.6)
    keyring (10.6.0)
    keyrings.alt (3.0)
    numpy (1.19.5)
    onnx (1.8.1)
    onnxruntime (1.3.0)
    Pillow (8.1.1)
    pip (9.0.1)
    protobuf (3.15.4)
    pycrypto (2.6.1)
    pygobject (3.26.1)
    pyxdg (0.25)
    SecretStorage (2.3.1)
    setuptools (39.0.1)
    six (1.11.0)
    tensorrt (7.2.3.4)
    torch (1.7.1+cu110)
    torchaudio (0.7.2)
    torchvision (0.8.2+cu110)
    typing-extensions (3.7.4.3)
    uff (0.6.9)
    wheel (0.30.0)

  • install command

  • try1
    pip3 install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

  • try 2
    pip3 install torch

same result …
As above ImportError …

this is bugs???

I want to use the triton version. because sample verion not install tensorRT trtexec.

In addition to
deepstream was good worked.
ex) deepstream-app -c <.txt>

Sorry for the late response, have you managed to get issue resolved?

thank you for you answer.
No… I could not solve in triton version
So, I was solved in a different way…
I used <5.1-21.02-samples> version and installed TensorRT7.2.2, installed pytorch. Then, I used import torch and TRT.
^^;;
maybe… next verion (trition) possible? right?!

thank you!

What is this docker?
Is it a triton docker - PyTorch Release Notes :: NVIDIA Deep Learning Frameworks Documentation? or deepstream 5.1 docker?

I installed it inside container to use pytorch. ==> what do you refer to by “it”?

Did you try - DeepStream 5.1-21.02-triton docker - NVIDIA NGC ?

thank you for you answer.
“it” is DeepStream 5.1-21.02-triton docker.
sorry … I did not write clearly. About the “it”
I have tried both DeepStream 5.1-21.02-triton docker…

I tried it on my side, it works as below.

$ docker run --gpus all -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/$user/:/home/$user/ -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream nvcr.io/nvidia/deepstream:5.1-21.02-devel

# apt-get install python3-pip
# pip3 install torch
# root@4661d61ab1f2:~# python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>>

thank you!!
I was solved!