awslambda-psycopg2 icon indicating copy to clipboard operation
awslambda-psycopg2 copied to clipboard

How to fix the following error. No module named 'psycopg2._psycopg'

Open aakashdusane opened this issue 3 years ago • 2 comments

Getting the following error: No module named 'psycopg2._psycopg' Python version: 3.9 Architecture: Arm64

aakashdusane avatar Jan 09 '23 13:01 aakashdusane

I wasn't able to resolve the issues I was having with this, but I was able to set up psycopg2 using klayers.

Klayers is a compilation of python packages built for lambda. They're given as ARNs - to add them, you can scroll to the bottom of your Lambda function in the Lambda console to Layers, click 'Add Layer' in the top-right, select 'Specify an ARN', then paste the ARN for the package you want.

You can find them in this repo: Klayers Repo

Or you can get a simple list by pasting the API link in your browser: https://api.klayers.cloud//api/v2/{YOUR PYTHON VERSION}/layers/latest/{YOUR AWS REGION}/html Enter the version of python in the form p0.0 (e.g. p3.8) and the region in the aws shortform (e.g. eu-west-1).

jakebelman avatar Apr 28 '23 16:04 jakebelman

Getting the following error: No module named 'psycopg2._psycopg' Python version: 3.9 Architecture: Arm64

If you use ARM64 try to change it to x86_64

flamron avatar Sep 07 '23 18:09 flamron