No module error while trying "Connect to AWS IoT"
0
I have followed the "Connect to AWS IoT" steps provided in AWS IOT (1.Register a device 2.Download a connection kit 3.Configure and test your device).
When I tried to run the script, I am getting No module named AWSIoTPythonSDK.MQTTLib
Environment: Platform: Linux Choose a AWS IoT Device SDK: Python
More info:
user::~/Downloads/connect_device_package$ ./start.sh
Downloading AWS IoT Root CA certificate from AWS...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1188 100 1188 0 0 7378 0 --:--:-- --:--:-- --:--:-- 7378
Cloning the AWS SDK...
Cloning into 'aws-iot-device-sdk-python'...
remote: Enumerating objects: 870, done.
remote: Counting objects: 100% (135/135), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 870 (delta 71), reused 58 (delta 58), pack-reused 735
Receiving objects: 100% (870/870), 334.31 KiB | 1.92 MiB/s, done.
Resolving deltas: 100% (423/423), done.
Installing AWS SDK...
~/Downloads/connect_device_package/aws-iot-device-sdk-python ~/Downloads/connect_device_package
Requirement already satisfied: AWSIoTPythonSDK in /home/om/.local/lib/python3.8/site-packages (1.4.9)
~/Downloads/connect_device_package
Running pub/sub sample application...
Traceback (most recent call last):
File "aws-iot-device-sdk-python/samples/basicPubSub/basicPubSub.py", line 18, in <module>
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
ImportError: No module named AWSIoTPythonSDK.MQTTLib
asked a month ago35 views
1 Answers
1
Accepted Answer
Hi Om. I'm guessing you have both python2 and python3 installed. Can you run the following command to check the version?
python --version
If it's 2.x, that would explain what you're seeing. If so, easiest way out is probably to edit line 32 of start.sh to call python3 instead of python.
answered a month ago
Relevant questions
No module error while trying "Connect to AWS IoT"
Accepted Answerasked a month agoAWS IoT - NodeJS
asked 3 months agocom.aws.greengrass.mqttclient.AwsIotMqttClient: Unable to connect to AWS IoT Core
Accepted Answerasked 6 months agoHow do Thing names work in IoT?
Accepted Answerasked 4 months agoHow to connect an IoT Thing to Greengrass V2
asked a year agoHow to design Mobile App to connect to MQTT Broker
asked 7 months agoGet Online/Offline status for iot thing using iot device client sdk
Accepted Answerasked 3 months agoAws Iot Device Client Setup not working
Accepted Answerasked 3 months agoAWS Iot Device Tester SSH Connection failing with EOF
asked 6 months agoHow to receive IoT device simulator's data to AWS IoT core.
Accepted Answerasked 8 days ago
Thanks Greg. It is working now :). Yes, I have both 2.x and 3 versions.