Unable to import pyds - cannot open shared object file

Hardware Platform: Jetson
DeepStream Version: 5.1
JetPack Version: 4.5.1
Issue Type: questions

I have followed all the instructions to setup the python binding for the deepstream. However, stuck in the initial execution while importing the pyds. Not sure what I am missing here. Any help is much appreciated.

> root@jetson:/opt/nvidia/deepstream/deepstream/lib# python3 setup.py install
> running install
> running build
> running build_py
> running install_lib
> copying build/lib/pyds.so -> /usr/local/lib/python3.6/dist-packages
> running install_egg_info
> Writing /usr/local/lib/python3.6/dist-packages/pyds-1.0.2.egg-info
> root@jetson:/opt/nvidia/deepstream/deepstream/lib# cd ..
> root@jetson:/opt/nvidia/deepstream/deepstream# cd sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out/
> root@jetson:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out# python3 deepstream_test1_rtsp_out.py -i rtsp://url -p 8554
> (print(sys.path))['/opt/nvidia/deepstream/deepstream-5.1/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages', '../']
> Traceback (most recent call last):
>   File "deepstream_test1_rtsp_out.py", line 36, in <module>
>     import pyds
> ImportError: /usr/local/lib/python3.6/dist-packages/pyds.so: cannot open shared object file: No such file or directory
> root@jetson:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out#

Have you done the steps in Python Sample Apps Source Details — DeepStream 5.1 Release documentation?

And the deepstream_test1_rtsp_out.py command line should be:

python3 deepstream_test1_rtsp_out.py -i <h264_elementary_stream>

It can not be rtsp uri.

I can not reproduce your error in my board.

Thanks for the reply. Yes I have done all that is listed in that documentation link.

In my case, the input itself is an rtsp stream, and i also want to stream the output as well to rtsp. I checked with the deepstream-app compiled executable and this works fine. I am trying to do same using python binding so i can make some changes that I want to do.

But i think I have not gone that far. The initial loading of the pyds itself is an issue. I checked if this is an path issue, but I can see pyds.so in /usr/local/lib/python3.6/dist-packages/ and also the sys.path includes this location as well. Still it wont import.

I can not reproduce the problem with my Jetson board.

Can you find “pyds.so” in /opt/nvidia/deepstream/deepstream-5.1/lib?

Yes, I am able to find pyds.so in the /opt/nvidia/deepstream/deepstream-5.1/lib. After running “python3 setup.py install” from that location the pyds.so is successfully installed to /usr/local/lib/python3.6/dist-packages as well. I have checked, this path is already included in the sys.path. But still “import pyds” wont work.

Can you reinstall your board? I can not reproduce your error.

Thanks for the help. Reinstall fixed the issue and i am able to import the pyds. I must have mistakenly installed x86_64 version of deepstream in the jetson during my previous install.

I also understand that I need to change the python code to use the rtsp input.