No module named "pyds"

Question about Deepstream Python Apps

When i run deepstream_test_1_usb.py in terminal, it tells me that “No module named ‘pyds’”.
But after i “pip3 install pyds”, it would tell me that “module ‘pyds’ has no attribute ’ gst_buffer_get_nvds_batch_meta’”.
How can i handle this?
项目地址

Hi,

the pyds is not a library that can be installed via pip. It is a library in the bundle provided by nvidia.
When you look in the downloaded “ds_pybind_v0.9.tbz2” (the Python Binding) you can see the folder “apps” with the Pyhton Examples and the Folder bindings. In this folder is the needed pyds for jetson and for x86_64.
When you start the examples from a custom location and not from the deepstream installation Folder, you have to copy the bindings folder to the same folder where you example, in your case the “deepstream_test_1_usb.py” is located. In the script change the line:
import pyds
to:
from bindings.jetson import pyds (or from bindings.x86_64 import pyds, when not on jetson devices)
You also have to change the paths for your Model in the “dstest1_pgie_config.txt” to the location where the models are located.
But best is, when you start the examples from the deepstream installaton path. On Debian for Deepstream 4 it would be:
/opt/nvidia/deepstream/deepstream-4.0/sources (search for the Python folder there)
Hope I could help you with this.

Greetings,
Sebastian

2 Likes

Thank you for you detailed answer!
I have solved this problem based on your answer.
The file path problem can be ended under your guidance.
Best wishes!
Lee

It would be nice if Nvidia included a setup.py or installed it on a system python path. As it is the only apps that can use it have to append sys.path explicitly and this path can change from release to release. Please, Nvidia, put stuff in standard locations.

2 Likes

Hi mdegans, thanks for the suggestion about installing in standard locations. We have put this on our roadmap.

2 Likes

Thanks! Really appreciate it!

Would the below simple setup.py work? We currently list pyds as package data since listing as extension requires source/build setup which is not part of our release.

Put this in setup.py and run it from the same directory as pyds.so:

from distutils.core import setup
setup (name = 'pyds',
       version = '0.9',
       description = """Install precompiled DeepStream Python bindings extension""",
       packages=[''],
       package_data={'': ['lib/pyds.so']},
       )

That’s an improvement for sure, but what would be really great is if the python bindings were either:

  • packaged with the deepstream debian package (so it gets installed someplace global)
    (or)
  • pip installable via pypi or git, or a wheel, like Google does for Coral.

The problem for me is not so much moving pyds.so into a python path, but obtaining it in the first place. I get that maybe you want people to sign an agreement that they won’t use DeepStream for bad purposes, but people who will don’t care about such an agreement and making it more difficult to download things only frustrates everybody.

Right now, to get the bindings, one must go to the releases section of github, which redirects to a login wall, which leads to a download for one tarball, inside of which is another tarball, and so forth… It’s too many steps, and some of them can’t be taken (easily) in, say, a Dockerfile. pip install is easy and “just works” on the other hand. The same I feel true for DeepStream itself. Version 4.0 is apt-get installable, at least on Tegra. I hope the same will be true for 5.0 in time as well.

Thanks for the input. We are working on packaging the bindings as part of the deepstream debian package.

1 Like

Hi.i have the same problem, and i dont have a file pyds.so in opt/nvidia/deepstream/deepstream/lib
environments:
jetpack4.4
deepstream5.0

Hi niuniu_niu1,

Please open a new topic for your issue. Thanks