Jetson.GPIO not working for detectnet inside the container dusty-nv jetson inference

I installed the JetPack 4.6.1 in an SD. After I installed the container for dusty-nv`s jetson inference R32.7.1.
The GPIO pins are not working inside the container.
Outside the container the pins are working properly, for example, I can run this code and the led is working according to the code:

import Jetson.GPIO as GPIO
import time

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)

while True:
    GPIO.output(7,True)
    print("True")
    time.sleep(5)
    GPIO.output(7,False)
    print("False")	
    time.sleep(5)

But inside the container the GPIO is not working. I tried:
Install GPIO inside the container, using this code:

sudo apt-get install python3-pip
sudo pip3 install Jetson.GPIO
sudo groupadd -f -r gpio
sudo usermod -a -G gpio your_user_name

According to the configuration that can be checked at the OS it seems that the GPIO0 and GPIO1 are mapped properly and it is possible (it has the permissions) for the container to access the GPIO pins. But when I run the code it shows this messages:

#root@jetson-desktop:/my-detection# python3 my-detection-gpio-only.py 
#Traceback (most recent call last):
#  File "my-detection-gpio-only.py", line 1, in <module>
#    import Jetson.GPIO as GPIO
#  File "/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/__init__.py", line 1, in <module>
#    from .gpio import *
#  File "/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio.py", line 33, in <module>
#    raise RuntimeError("The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this. It is also possible that {} does not exist. Please check if that file is present.".format(_GPIOCHIP_ROOT))
#RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this. It is also possible that /dev/gpiochip0 does not exist. Please check if that file is present.

The issue does not make sense for me:

  • When I am inside the container I am root.
  • The permissions are configured
  • /dev/gpiochip0 does exist

See if it helps.

Thank you @DaveYYY, but it didn’t work… Maybe it is because it is oriented to Raspberry Pi.

Hope, someone can help with Jetson nano

Sorry that we don’t have experience on such use cases.
See if other users can share their tips.

Hi @mi_k, you might want to check out this thread:

or you can build jetson-inference source outside of container and use GPIO without docker.

Hey there! I had the same issue, the easiest solution for me was to go into the jetson-inference/docker folder on your machine. Then open run.sh in text editor and add the --privileged command in the docker run script. Like so:

run the container

if [ $ARCH = “aarch64” ]; then

# /proc or /sys files aren't mountable into docker
cat /proc/device-tree/model > /tmp/nv_jetson_model

sudo docker run --runtime nvidia -it --rm \
	--network host \
	--privileged\
	-v /tmp/argus_socket:/tmp/argus_socket \
	-v /etc/enctune.conf:/etc/enctune.conf \
	-v /etc/nv_tegra_release:/etc/nv_tegra_release \
	-v /tmp/nv_jetson_model:/tmp/nv_jetson_model \
	$DISPLAY_DEVICE $V4L2_DEVICES \
	$DATA_VOLUME $USER_VOLUME $DEV_VOLUME \
	$CONTAINER_IMAGE $USER_COMMAND

After trying many things it WORKED!!!

I just added "–privileged " as @yjain0102 mentioned

Thank you very much indeed

1 Like