'"Namespace GstRtspServer not available" when i run it outside of the docker

after i finished a course from Nvidia using Jetson nano, i tried to run a python file outside of the docker that i created in the course, but it shows an error:

Traceback (most recent call last):
File "deepstream_test_1_usb.py", line 26, in <module>
gi.require_version('GstRtspServer', '1.0')
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 130, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GstRtspServer not available

Python code snippet:

import argparse
import sys
sys.path.append('../')

import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import GObject, Gst, GstRtspServer
from common.is_aarch_64 import is_aarch64
from common.bus_call import bus_call

import pyds

But when i run the docker file and then run the python file it works without any problem. The docker file content:

sudo docker run --runtime nvidia -it --rm --network host     -v /tmp/.X11-unix/:/tmp/.X11-unix     -v /tmp/argus_socket:/tmp/argus_socket     -v ~/my_apps:/dli/task/my_apps     --device /dev/video0     nvcr.io/nvidia/dli/dli-nano-deepstream:v2.0.0-DS6.0.1 

Does anyone have a solution for that? I'm a beginner in Docker and ubuntu.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source