# Importing Neo4j Package into Python AWS Lambda Function

**URL:** <https://community.neo4j.com/t/importing-neo4j-package-into-python-aws-lambda-function/50011>\
**Category:** Import / Export\
**Tags:** import\
**Created:** [January 5, 2022, 3:44pm UTC](https://community.neo4j.com/t/importing-neo4j-package-into-python-aws-lambda-function/50011 "2022-01-05T15:44:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthony\_gatlin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/anthony_gatlin/32/5417_2.png) [@anthony\_gatlin](https://community.neo4j.com/u/anthony_gatlin)\
**Post date:** [January 5, 2022, 3:44pm UTC](https://community.neo4j.com/t/importing-neo4j-package-into-python-aws-lambda-function/50011/1 "2022-01-05T15:44:11Z")

</div>

We need to use Neo4j with Python AWS Lambda functions. We are unable to upload the Neo4j Python library along with the deployment package. We are able to download the Neo4j .tar.gz package. How do we include it in our Lambda deployment package?

---

<div class="post-metadata">

**Author:** ![david\_allen](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_allen/32/13090_2.png) [@david\_allen](https://community.neo4j.com/u/david_allen)\
**Post date:** [January 5, 2022, 8:51pm UTC](https://community.neo4j.com/t/importing-neo4j-package-into-python-aws-lambda-function/50011/2 "2022-01-05T20:51:28Z")

</div>

Neo4j itself (the database) doesn't get packaged with AWS Lambda functions, but the python driver to talk to Neo4j does.

AWS has documentation on how to package any python dependency together with the python code for your lambda function, which you can find here:

> **[Deploy Python Lambda functions with .zip file archives - AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/python-package.html)**
>
> Learn how to deploy Python Lambda function code using a .zip file deployment package.

The short version is that you create a ZIP file, and what you push to the cloud to be your lambda function isn't your python code, but rather a ZIP archive containing your python code and other things, including dependencies.

I would really recommend a python virtual environment setup like venv, poetry, etc. This can help with the packaging process

They have a full worked example here: [Deploy Python Lambda functions with .zip file archives - AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/python-package.html#python-package-create-package-with-dependency)

Finally -- with Neo4j/python, all you really need is the neo4j driver `pip install neo4j` as a dependency. Everything else is the same, you can follow those docs above and there aren't any Neo4j specific differences.
