-
-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ERROR] Runtime.ImportModuleError: Unable to import module 'ueba': libpq.so.5: cannot open shared object file: No such file or directory #1010
Comments
So i changed the build.sh to install psycopg2-binary instead of psycopg2 as per the github link: build.sh#!/bin/sh if [ ! -d "venv" ]; then if [ -z "$VIRTUAL_ENV" ]; then if [ -n "$VIRTUAL_ENV" ]; then When I tried running the lambda I am getting the following error now: [ERROR] Runtime.ImportModuleError: Unable to import module 'ueba': /var/task/psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8 Can you please let me know what am I missing here ? Thanks, |
This is pretty explicit.
In the second case probably wrong python library version. If you install psycopg by taking bits off one computer and copying to another computer you should know yourself what you are doing. Whatever happens is not our fault and I can't help with it. |
@dvarrazzo
[ERROR] Runtime.ImportModuleError: Unable to import module 'ueba': libpq.so.5: cannot open shared object file: No such file or directory I see you have closed this issue. Thanks, |
For anybody who doesn't like this developer's hostile attitude (because of his architectural design choices that require native code), there are various pure python postgres clients, some of which claim to be faster than psycopy2-2.8.1. Switching to ps8000 for lambdas is a solid solution. See the full list here: https://wiki.postgresql.org/wiki/Python |
Hi,
I am trying to use PostgreSQL in my AWS Lambda service.As part of that I have a build script that installs postgres using pip and sets LD_LIBRARY_PATH
requirements.txt
boto3==1.10.5
botocore==1.13.5
psycopg2==2.8.4
build.sh
#!/bin/sh
export PYTHONUNBUFFERED=1
if [ ! -d "venv" ]; then
virtualenv venv
fi
if [ -z "$VIRTUAL_ENV" ]; then
source venv/bin/activate
fi
if [ -n "$VIRTUAL_ENV" ]; then
venv/bin/pip install -U pip
venv/bin/pip install -U -r ./asset_db/requirements/requirements.txt
venv/bin/pip freeze --local
fi
export LD_LIBRARY_PATH="/usr/lib64/:$LD_LIBRARY_PATH"
I have a python file called ueba.py that has invocation function for lambda service.
ueba.py
import psycopg2
def database():
psycopg2.connect(user=,
password=,
host=,
port=,
database=)
def lambda_handler(event, context):
print("Lambda started")
print(event)
database()
print("Lambda Completed")
As part of build process I am creating a zip of the lambda service and uploading it on AWS and testing the lambda function.But when the Lambda function gets triggered I get the following error:
[ERROR] Runtime.ImportModuleError: Unable to import module 'ueba': libpq.so.5: cannot open shared object file: No such file or directory
I understand it is a shared object that is needed at runtime.Since I am installing the psycopg2 using pip where will I find this shared object file and how to set the path to locate it.
Thanks,
Nitish
The text was updated successfully, but these errors were encountered: