Jetson Nano Adafruit_Servokit Issue

I am trying to run the following code to use servo motor:

from adafruit_servokit import ServoKit

myKit = ServoKit(channels=16)
myKit.servo[0].angle=90

however, I am getting the following error when I run it.

Traceback (most recent call last):
File “servo.py”, line 1, in
from adafruit_servokit import ServoKit
ImportError: No module named adafruit_servokit

I had already run the following command to install adafruit_servokit
pip3 install adafruit-circuitpython-servokit==1.3.8

I’m not what the issue is because it says at the end of the command that the following was successfully installed

Successfully installed Adafruit-Blinka-6.15.0 Adafruit-PlatformDetect-3.20.1 Adafruit-PureIO-1.1.9 Jetson.GPIO-2.0.21 adafruit-circuitpython-busdevice-5.2.3 adafruit-circuitpython-motor-3.4.7 adafruit-circuitpython-pca9685-3.4.7 adafruit-circuitpython-register-1.9.15 adafruit-circuitpython-requests-1.12.12 adafruit-circuitpython-servokit-1.3.8 adafruit-circuitpython-typing-1.8.3 pyftdi-0.53.3 pyserial-3.5 pyusb-1.2.1 typing-extensions-4.1.1

Probably you’re using the wrong version of python.

You use pip3 but

$ python --version

is probably 2.7

either specify python3 or change the default with update-alternatives or other method

How to change from default to alternative Python version on Debian Linux - Linux Tutorials - Learn Linux Configuration

Using python3 does get rid of the error a new error shows up.
Traceback (most recent call last):
File “servo.py”, line 1, in
from adafruit_servokit import ServoKit
File “/home/capstone/.local/lib/python3.6/site-packages/adafruit_servokit.py”, line 35, in
import board
File “/home/capstone/.local/lib/python3.6/site-packages/board.py”, line 39, in
import adafruit_platformdetect.constants.boards as ap_board
File “/home/capstone/.local/lib/python3.6/site-packages/adafruit_platformdetect/init.py”, line 10, in
from .board import Board
File “/home/capstone/.local/lib/python3.6/site-packages/adafruit_platformdetect/board.py”, line 24
from future import annotations
^
SyntaxError: future feature annotations is not defined

try python 3.8

1 Like

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