Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Vision, Text detection, bug : ImportError: cannot import name 'cygrpc' from 'grpc._cython'

Hello,

When running recommanded code for text detection on page Détecter le texte dans les images  |  API Cloud Vision  |  Google Cloud :

 

def detect_text(path):
    """Detects text in the file."""
    from google.cloud import vision
    import io
    client = vision.ImageAnnotatorClient()

    with io.open(path, 'rb') as image_file:
        content = image_file.read()

    image = vision.Image(content=content)

    response = client.text_detection(image=image)
    texts = response.text_annotations
    print('Texts:')

    for text in texts:
        print('\n"{}"'.format(text.description))

        vertices = (['({},{})'.format(vertex.x, vertex.y)
                    for vertex in text.bounding_poly.vertices])

        print('bounds: {}'.format(','.join(vertices)))

    if response.error.message:
        raise Exception(
            '{}\nFor more info on error messages, check: '
            'https://cloud.google.com/apis/design/errors'.format(
                response.error.message))

 

... I get following error:

 

ImportError: cannot import name 'cygrpc' from 'grpc._cython'

 

I found somewhere that it might be my python version. So, I changed from Python310 to Python377. But nothing changed.

Would you have any idea?

Kind regards.

0 1 1,292
1 REPLY 1

I believe it has something to do with your python dependencies, Can you run this command in your library ? ```sudo pip3 install -U grpcio```