I am trying to access Google Cloud Vision API to perform OCR from Raspberry Pi 3. I have followed the instructions in the given link -
https://cloud.google.com/vision/docs/libraries#client-libraries-install-python
However, when I try to import the library using the following code, I an error as shown below -
import io
import os
# Imports the Google Cloud client library
from google.cloud import vision
I get this error. I have navigated inside the directory - /usr/local/lib/python3.4/dist-packages/google/auth/transport/ and I have found the requests.py file. I have also installed the Python requests module. In spite of that I get the following error.
/usr/local/lib/python3.4/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version!
RequestsDependencyWarning)
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/google/auth/transport/requests.py", line 23, in <module>
import requests
File "/usr/local/lib/python3.4/dist-packages/requests/__init__.py", line 90, in <module>
from urllib3.exceptions import DependencyWarning
ImportError: cannot import name 'DependencyWarning'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "gc.py", line 7, in <module>
from google.cloud import vision
File "/usr/local/lib/python3.4/dist-packages/google/cloud/vision.py", line 20, in <module>
from google.cloud.vision_v1 import enums
File "/usr/local/lib/python3.4/dist-packages/google/cloud/vision_v1/__init__.py", line 22, in <module>
from google.cloud.vision_v1.gapic import image_annotator_client as iac
File "/usr/local/lib/python3.4/dist-packages/google/cloud/vision_v1/gapic/image_annotator_client.py", line 18, in <module>
import google.api_core.gapic_v1.client_info
File "/home/pi/.local/lib/python3.4/site-packages/google/api_core/gapic_v1/__init__.py", line 17, in <module>
from google.api_core.gapic_v1 import method
File "/home/pi/.local/lib/python3.4/site-packages/google/api_core/gapic_v1/method.py", line 22, in <module>
from google.api_core import grpc_helpers
File "/home/pi/.local/lib/python3.4/site-packages/google/api_core/grpc_helpers.py", line 27, in <module>
import google.auth.transport.requests
File "/usr/local/lib/python3.4/dist-packages/google/auth/transport/requests.py", line 31, in <module>
caught_exc,
File "<string>", line 3, in raise_from
ImportError: The requests library is not installed, please install the requests package to use the requests transport.
Please help.
EDIT -
I tried sudo pip3 install --upgrade requests and got the following status -
Requirement already up-to-date: requests in /usr/local/lib/python3.4/dist-packages
Cleaning up...
sudo pip install --upgrade requests(If you have Python 2.7 and 3.4, probably you have to use pip3)