google-cloud-python: [Speech] does not work from AWS Lambda
Google.cloud.speech

fails within AWS Lambda environment, works fine on windows
python 3.6
Error message:
Unable to import module 'My_Module': cannot import name 'cygrpc'
To reproduce: create dummy Lambda function, copy code to windows, import google.cloud.speech, install libs into folder, create lambda bundle by zipping together and upload to lambda. module can’t be loaded
- Code example
import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = './gcp-info-insights.json'
import base64 as b64
import boto3
import sys
sys.path.append('./lib')
from google.cloud import speech_v1p1beta1 as speech
from google.cloud.speech_v1p1beta1 import enums
from google.cloud.speech_v1p1beta1 import types
print('Loading function, this will never be reached as some dependencies of google.cloud.api can't be loaded, particularly cygrpc')
s3 = boto3.client('s3')
def lambda_handler(event, context):
#leave blunk
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (6 by maintainers)
I had the same issue " cannot import name ‘cygrpc’ " while running the lambda.
Solved it with
pip install google-cloud-visionin the AMI amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2 instanceand exported the
lib/python3.6/site-packagesto aws lambda Thank you @tseaverI was able to deploy it from my mac machine using