no module named portaudio aws lambda - python

I currently have some python code that I have stored in a zip file with my dependencies. The code compiles and works fine locally in Visual Studio Code. However, when I go to upload the file onto a Lambda function, I get this error:
{
"errorMessage": "Unable to import module 'lambda_function': No module named '_portaudio'",
"errorType": "Runtime.ImportModuleError",
"stackTrace": []
}
I am using pyaudio and I have never had any interaction with portaudio. What should I do?
Attached is a screenshot of my zip file:
Image Updates

Related

appium library is unresolved in robocorp extension VS code

enter image description here
no matter what i do the ide does not recognize the appium lib
Unresolved library: Appium.
Error generating libspec:
Importing library 'Appium' failed: ModuleNotFoundError: No module named 'Appium'
Consider adding the needed paths to the "robot.pythonpath" setting
and calling the "Robot Framework: Clear caches and restart" action.robotframework

"Unable to import module 'lambda_function': libasound.so.2: cannot open shared object file: No such file or directory",

I have created a lambda layer with the following python packages using pip3:
google-cloud-texttospeech and
azure-cognitiveservices-speech
When I use this layer with python3.8 lambda function, I get the error saying,
{
"errorMessage": "Unable to import module 'lambda_function': libasound.so.2: cannot open shared object file: No such file or directory",
"errorType": "Runtime.ImportModuleError"
}
I removed the azure-cognitiveservices-speech package and the layer works fine with lambda. This means that the culprit is the azure-cognitiveservices-speech package. I couldn't find a way to solve the problem.
Any kind of help will be grately appreciated. Thank you!
So you need to install the package manually on your system and package the same with your lambda zip file as per the documentation
Once installed you can package your python code and the .so files together and upload to AWS lambda. The folder structure for your reference should look like this.
myawesomefunction.py
libasound.so.2

error while uploading python zip file with psycopg2 to aws lambda

I'm trying to add the python zip files to was lambda which contains psycopg2 files in it.I'm getting an error. please try to help
"errorMessage": "Unable to import module 'handler': libpq.so.5: cannot open shared object file: No such file or directory",
"errorType": "Runtime.ImportModuleError"
The point is psycopg2 depends on native code (libpq.so) and your zip file does not contain this dependency.
See here for a solution
Another option is pip install psycopg2-binary. See here for details.

Serverless AWS Lambda : no module named `secret_manager`

Installed serverless-python-requirements using npm.
I use secret-manager library in handler.py
I am able to successfully deploy lambda function using serverless (no errors).
I have secret-manager listed (along with other pypi packages) in requirements.txt
In order to package it, I include following lines in serverless.yml
pythonRequirements:
dockerizePip: true
To verify if secret-manager is packaged with the other PyPi binaries:
I downloaded the deployed lambda as a zip file and verified it does have secretmanager along with other pypi binaries.
But, still for some reason, it still fails saying secret-manager module not found..
{
"errorMessage": "Unable to import module 'handler': No module named 'secret_manager'",
"errorType": "Runtime.ImportModuleError"
}
Note the name of folder of PyPi is secretmanager and the name of file inside it is secret_manager.py
For reference :
I forgot to include a separate user-written file secret_manager.py that had the logic for getting secret from secret-manager. It had nothing to do with the PyPi binary.

Create a MinIO Bucket in NiFi - Using ExecuteScript processor and (J)python

The 5 S3 related processor present in NiFi cannot create a Minio Bucket.
ListS3
PutS3Object
DeleteS3Object
FetchS3Object
TagS3Object
So I tried to use the ExecuteScript processor and import the python minio module inside of it
In order to do that I install pip3 on my CentOS machine and did pip3 install minio(it installed it in /usr/local/lib/python3.6/site-packages/).
Then in my ExecuteProcessor I set the following configuration :
Script Engine : python
Script File : No value set
Script Body :
from minio import Minio
from minio.error import (ResponseError, BucketAlreadyOwnedByYou,
BucketAlreadyExists)
minioClient = Minio('minio',
access_key='XXXX',
secret_key='XXXX')
Module Directory: /usr/local/lib/python3.6/site-packages/
But I keep getting this error
No module named builtins in at line number 1
Full error :
ExecuteScript[id=3a3e689a-0170-1000-fa4d-b0874062b8cc] ExecuteScript[id=3a3e689a-0170-1000-fa4d-b0874062b8cc] failed to process due to javax.script.ScriptException: ImportError: No module named builtins in at line number 1; rolling back session: org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named builtins in at line number 1
Hypothesis 1 :
Of what I understand NiFi use Jython and then cannot use C-related Python module, I couldn't find the confirmation that minio-py was one of them but it seems to be the most relevant reason.
is there something I'm missing ?

Categories

Resources