简体   繁体   中英

Error while running Google Vision API on raspberry pi

I have a python program that runs Google Vision API on the raspberry pi (Model 3B+), I have installed all the required libraries and have the.json file in place, but still getting the following error:

Traceback (most recent call last):
  File "/home/pi/Desktop/SenProjCode.py", line 9, in <module>
    from google.cloud import vision
  File "/home/pi/.local/lib/python3.9/site-packages/google/cloud/vision/__init__.py", line 18, in <module>
    from google.cloud.vision_v1.services.image_annotator.async_client import (
  File "/home/pi/.local/lib/python3.9/site-packages/google/cloud/vision_v1/__init__.py", line 20, in <module>
    from .services.image_annotator import ImageAnnotatorClient as IacImageAnnotatorClient
  File "/home/pi/.local/lib/python3.9/site-packages/google/cloud/vision_v1/services/image_annotator/__init__.py", line 16, in <module>
    from .client import ImageAnnotatorClient
  File "/home/pi/.local/lib/python3.9/site-packages/google/cloud/vision_v1/services/image_annotator/client.py", line 25, in <module>
    from google.api_core import gapic_v1  # type: ignore
  File "/home/pi/.local/lib/python3.9/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in <module>
    from google.api_core.gapic_v1 import config
  File "/home/pi/.local/lib/python3.9/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
    import grpc
  File "/home/pi/.local/lib/python3.9/site-packages/grpc/__init__.py", line 22, in <module>
    from grpc import _compression
  File "/home/pi/.local/lib/python3.9/site-packages/grpc/_compression.py", line 15, in <module>
    from grpc._cython import cygrpc
ImportError: /home/pi/.local/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-arm-linux-gnueabihf.so: undefined symbol: __atomic_exchange_8
>>> 

This is part of the code I have written:

import os
import io
import picamera
from numpy import random
from gtts import gTTS
from google.cloud import vision
from google.cloud.vision import types
from PIL import Image
import pandas as pd
import vlc
import RPi.GPIO as GPIO
import time

##Using the JSON file for the API
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'/home/pi/Downloads/GoogleAPI.json'

What gRPC version did you use? I think this will be fixed by gRPC Python 1.44 and in the meantime you may want to use workaround for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM