Reputation: 19
I'm trying to use aws rekognition client using boto3 on my raspberry pi, have successfully installed aws cli and have configured it also. But when i execute the following code avaialbe in aws blog,
import boto3
def detect_labels_local_file(photo):
client=boto3.client('rekognition')
with open(photo, 'rb') as image:
response = client.detect_labels(Image={'Bytes': image.read()})
print('Detected labels in ' + photo)
for label in response['Labels']:
print (label['Name'] + ' : ' + str(label['Confidence']))
return len(response['Labels'])
def main():
photo='photo'
label_count=detect_labels_local_file(photo)
print("Labels detected: " + str(label_count))
if __name__ == "__main__":
main()
I get the following error :
import boto3
File "/usr/local/lib/python3.7/dist-packages/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/usr/local/lib/python3.7/dist-packages/boto3/session.py", line 17, in <module>
import botocore.session
File "/home/pi/.local/lib/python3.7/site-packages/botocore/session.py", line 28, in <module>
import botocore.configloader
File "/home/pi/.local/lib/python3.7/site-packages/botocore/configloader.py", line 19, in <module>
from botocore.compat import six
File "/home/pi/.local/lib/python3.7/site-packages/botocore/compat.py", line 25, in <module>
from botocore.exceptions import MD5UnavailableError
File "/home/pi/.local/lib/python3.7/site-packages/botocore/exceptions.py", line 99, in <module>
class SSLError(ConnectionError, requests.exceptions.SSLError):
AttributeError: module 'botocore.vendored.requests' has no attribute 'exceptions
Please help me solve it , or tell me what i'm doing wrong . Note : I'm using python 3.7.3 .
Upvotes: 1
Views: 1541
Reputation: 35258
This blog post should help to explain it.
You will now need to include this dependency yourself as it is no longer bundled with boto3.
For you Raspberry Pi running the following should be sufficient
pip install requests
Then add import requests
to your py script
Upvotes: 1