How do I import a Jetson GPIO into a Jupyter Notebook?

Hello, I’d like to use led on Jupyter Notebook. However, I am unable to import Jetson GPIO into Jupyter Notebook. I tried every method listed in this resource : GitHub - NVIDIA/jetson-gpio: A Python library that enables the use of Jetson's GPIOs to install GPIO on my Jetson Nano. And I still can’t import Jetson GPIO into Jupyter Notebook. Could you please assist me?

*By the way, the led works fine when I run it in the terminal (not in Jupyter Notebook).

Have a reference to below topic.

Thank you in advance for your response, and please accept my apologies for only reading the message. Previously, I finished the installation with pip, manual, and clone. However, the outcome remains the same. So, what’s the answer?
Thank you

The error looks like permission problem. Maybe try to chmod 777 /usr/local/lib/python3.6/dist-packeges/Jetson/GPIO

Hello, and thank you in advance for your response. I’ve tried this method but it still doesn’t work.

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

Oh, it’s fine. Previously, I had not found a solution. Is there another solution to this problem?
Thank you very much.

Adding the --privileged option to the docker run command solves the problem.

How to reproduce with JetPack 4.6.1
before:

docker run -it --rm --network host nvcr.io/nvidia/l4t-ml:r32.7.1-py3

after:

docker run -it --rm --privileged --network host nvcr.io/nvidia/l4t-ml:r32.7.1-py3

This is an easy problem to solve if you describe how to reproduce the problem, including the docker run command.

use sudo or sudo su

sudo docker run ...
# or 
sudo su
docker run ...

Hi thanks for the response. I’ve tried using the run docker command, when I tried import. GPIO in Jupyter Lab it still didn’t work.

Previously I wanted to ask, is it possible to run import.GPIO on Jupyter Lab (Image Classification Project) like this link?

I do not know how to reproduce your problem.
After inserting a JetPack 4.6.1 SD card into your Jetson Nano
What did you do?
Please describe the steps you took to reproduce the problem.

I did Configure OS on Jetson Nano after inserting the JetPack 4.6.1 SD card into the Jetson Nano. Then I tried the way to headless device mode and download docker to access/start JupyterLab. I run the command as follows:

echo “sudo docker run --runtime nvidia -it --rm --network host
–volume ~/nvdli-data:/nvdli-nano/data
–device /dev/video0
nvcr.io/nvidia/dli/dli-nano-ai:v2.0.2-r32.7.1” > docker_dli_run.sh

Put the --privileged option like after.
before:

echo "sudo docker run --runtime nvidia -it --rm --network host
–volume ~/nvdli-data:/nvdli-nano/data
–device /dev/video0
nvcr.io/nvidia/dli/dli-nano-ai:v2.0.2-r32.7.1" > docker_dli_run.sh

after:

echo "sudo docker run --runtime nvidia -it --rm --network host --privileged
–volume ~/nvdli-data:/nvdli-nano/data
–device /dev/video0
nvcr.io/nvidia/dli/dli-nano-ai:v2.0.2-r32.7.1" > docker_dli_run.sh

Can you check with this?

Hello, sorry for the late response. I just tried it and was successful in importing gpio into the Jupyter Lab. Thank you very much for the solution you provided ^^.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.