Jetson.GPIO is installed but cannot be imported?

Hi, i’m working in a virtual environment with all my packages (blinka, servokit, Jetson.GPIO) have been installed successfully, but when i try to import Jetson.GPIO, it keep telling me that i have not installed the library. Please help me with this error. Thank you.
This is the terminal output:

(tomatovenv) hietrn@Hien:~/tomato3$ python3.6 -m pip install Jetson.GPIO
Looking in indexes: Simple index, https://pypi.ngc.nvidia.com
Requirement already satisfied: Jetson.GPIO in ./tomatovenv/lib/python3.6/site-packages (2.1.3)

(tomatovenv) hietrn@Hien:~/tomato3$ python3.6 simpleservo.py
Traceback (most recent call last):
File “simpleservo.py”, line 1, in
from adafruit_servokit import ServoKit
File “/home/hietrn/tomato3/tomatovenv/lib/python3.6/site-packages/adafruit_servokit.py”, line 35, in
import board
File “/home/hietrn/tomato3/tomatovenv/lib/python3.6/site-packages/board.py”, line 148, in
from adafruit_blinka.board.nvidia.jetson_nano import *
File “/home/hietrn/tomato3/tomatovenv/lib/python3.6/site-packages/adafruit_blinka/board/nvidia/jetson_nano.py”, line 3, in
from adafruit_blinka.microcontroller.tegra.t210 import pin
File “/home/hietrn/tomato3/tomatovenv/lib/python3.6/site-packages/adafruit_blinka/microcontroller/tegra/t210/pin.py”, line 4, in
import Jetson.GPIO as GPIO
ModuleNotFoundError: No module named ‘Jetson.GPIO’

Hi jetsonnanoremote,

Have you referred to the following instruction to setup the build environment for jetson-gpio?
GitHub - NVIDIA/jetson-gpio: A Python library that enables the use of Jetson’s GPIOs

Yes, that’s correct. I’ve followed every step on setting up the GPIO environment. I just tried to uninstall Jetson.GPIO completely and reinstall but it still cannot import. Before, i use python3.7 to install it and it worked fine, but now i uninstall python3.7 and reinstall it using python3.6, it wont let me import.
Can it be some kind of wrong path or something?

I just tried to install it manually, the installation is successful but still cannot import the library.
This is the terminal:

hietrn@Hien:~/Downloads/jetson-gpio$ sudo python3 setup.py install
running install
/home/hietrn/.local/lib/python3.6/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
/home/hietrn/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
EasyInstallDeprecationWarning,
/home/hietrn/.local/lib/python3.6/site-packages/pkg_resources/init.py:119: PkgResourcesDeprecationWarning: 0.18ubuntu0.18.04.1 is an invalid version and will not be supported in a future release
PkgResourcesDeprecationWarning,
running bdist_egg
running egg_info
creating lib/python/Jetson.GPIO.egg-info
writing lib/python/Jetson.GPIO.egg-info/PKG-INFO
writing dependency_links to lib/python/Jetson.GPIO.egg-info/dependency_links.txt
writing top-level names to lib/python/Jetson.GPIO.egg-info/top_level.txt
writing manifest file ‘lib/python/Jetson.GPIO.egg-info/SOURCES.txt’
reading manifest file ‘lib/python/Jetson.GPIO.egg-info/SOURCES.txt’
reading manifest template ‘MANIFEST.in’
warning: no files found matching ‘LICENCE.txt’
adding license file ‘LICENSE.txt’
writing manifest file ‘lib/python/Jetson.GPIO.egg-info/SOURCES.txt’
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/Jetson
copying lib/python/Jetson/init.py → build/lib/Jetson
creating build/lib/Jetson/GPIO
copying lib/python/Jetson/GPIO/init.py → build/lib/Jetson/GPIO
copying lib/python/Jetson/GPIO/gpio_cdev.py → build/lib/Jetson/GPIO
copying lib/python/Jetson/GPIO/gpio_event.py → build/lib/Jetson/GPIO
copying lib/python/Jetson/GPIO/gpio.py → build/lib/Jetson/GPIO
copying lib/python/Jetson/GPIO/gpio_pin_data.py → build/lib/Jetson/GPIO
creating build/lib/RPi
copying lib/python/RPi/init.py → build/lib/RPi
creating build/lib/RPi/GPIO
copying lib/python/RPi/GPIO/init.py → build/lib/RPi/GPIO
copying lib/python/Jetson/GPIO/99-gpio.rules → build/lib/Jetson/GPIO
creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/Jetson
copying build/lib/Jetson/init.py → build/bdist.linux-aarch64/egg/Jetson
creating build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/init.py → build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio_cdev.py → build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio_event.py → build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio.py → build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio_pin_data.py → build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/99-gpio.rules → build/bdist.linux-aarch64/egg/Jetson/GPIO
creating build/bdist.linux-aarch64/egg/RPi
copying build/lib/RPi/init.py → build/bdist.linux-aarch64/egg/RPi
creating build/bdist.linux-aarch64/egg/RPi/GPIO
copying build/lib/RPi/GPIO/init.py → build/bdist.linux-aarch64/egg/RPi/GPIO
byte-compiling build/bdist.linux-aarch64/egg/Jetson/init.py to init.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/init.py to init.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_cdev.py to gpio_cdev.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_event.py to gpio_event.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio.py to gpio.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_pin_data.py to gpio_pin_data.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/RPi/init.py to init.cpython-36.pyc
byte-compiling build/bdist.linux-aarch64/egg/RPi/GPIO/init.py to init.cpython-36.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/PKG-INFO → build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/SOURCES.txt → build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/dependency_links.txt → build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/top_level.txt → build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents…
creating dist
creating ‘dist/Jetson.GPIO-2.1.3-py3.6.egg’ and adding ‘build/bdist.linux-aarch64/egg’ to it
removing ‘build/bdist.linux-aarch64/egg’ (and everything under it)
Processing Jetson.GPIO-2.1.3-py3.6.egg
Copying Jetson.GPIO-2.1.3-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding Jetson.GPIO 2.1.3 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/Jetson.GPIO-2.1.3-py3.6.egg
Processing dependencies for Jetson.GPIO==2.1.3
Finished processing dependencies for Jetson.GPIO==2.1.3
hietrn@Hien:~/Downloads/jetson-gpio$ python3.6
Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import Jetson.GPIO
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘Jetson.GPIO’

Finally found a way to fix this, turns out it’s the problem with the path in the directory and one failed Jetson.GPIO library installation. What i’ve done to fix it is:

  1. run python then import Jetson (only Jetson, no GPIO). If success, run “Jetson.path” to see the containing folder
  2. Locate to that folder, this problably not gonna have the folder “GPIO” that we need. Then sudo rm -rf “path to that Jetson folder”

This worked for me. Goodluck.

1 Like

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