# Errors when using AS Python client for AWS Lambda with SAM CLI on Ubuntu 18.04

**URL:** <https://discuss.aerospike.com/t/errors-when-using-as-python-client-for-aws-lambda-with-sam-cli-on-ubuntu-18-04/7011>\
**Category:** Installation\
**Created:** [January 4, 2020, 7:41am UTC](https://discuss.aerospike.com/t/errors-when-using-as-python-client-for-aws-lambda-with-sam-cli-on-ubuntu-18-04/7011 "2020-01-04T07:41:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidm](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/davidm/32/1344_2.png) [@davidm](https://discuss.aerospike.com/u/davidm)\
**Post date:** [January 4, 2020, 7:41am UTC](https://discuss.aerospike.com/t/errors-when-using-as-python-client-for-aws-lambda-with-sam-cli-on-ubuntu-18-04/7011/1 "2020-01-04T07:41:58Z")

</div>

I am trying to build local development environment for AWS Lambda deployments that includes Aerospike client. I made a new install of Ubuntu 18.04.3 at VirtualBox, upgraded.

Following [AWS instructions](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html), I got SAM CLI properly working with docker at that machine.

I installed PyCharm 2019.3.1 via Ubuntu Applications and selected AWS toolkit, while specifying an IAM user to access AWS. I selected the pre-installed Python 3.6 for the “Lambda Hello World” project. I can successfully run “Hello World” app and I am getting the correct JSON response in PyCharm console:

> {“statusCode”:200,“body”:“{"message": "hello world"}”}

So far it all good.

Now I installed aerospike python client:

`sudo apt install python3-pip`

`sudo apt install libssl-dev zlib1g-dev curl`

`pip3 install aerospike==3.6.0`

and added

`import aerospike`

to hello\_world/app.py

and

`aerospike==3.6.0`

line to hello\_world/requirements.txt

these are the only changes I made.

After that I got an error when running the same sample “Hello World” app:

> Unable to import module ‘app’: libssl.so.1.1: cannot open shared object file: No such file or directory

I tried copying libssl.so.1.1 to the “project home” folder at hello\_world/

`cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 [...]/hello_world/`

but then I got another error from SAM:

> Unable to import module ‘app’: libcrypto.so.1.1: cannot open shared object file: No such file or directory

Adding also libcrypto.so.1.1 to […]/hello\_world/ ends up with

> Unable to import module ‘app’: /lib64/libc.so.6: version `GLIBC\_2.25’ not found (required by /var/task/libcrypto.so.1.1)

What I am doing wrong and how to get Aerospike Python client work for AWS Lambda / SAM CLI docker environment on Ubuntu 18.04?

---

<div class="post-metadata">

**Author:** ![davidm](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/davidm/32/1344_2.png) [@davidm](https://discuss.aerospike.com/u/davidm)\
**Post date:** [January 4, 2020, 5:43pm UTC](https://discuss.aerospike.com/t/errors-when-using-as-python-client-for-aws-lambda-with-sam-cli-on-ubuntu-18-04/7011/2 "2020-01-04T17:43:46Z")

</div>

Found a simple answer to that:

**`Build function inside a container`**

checkbox in PyCharm HelloWorldFunction project configuration, SAM CLI tab. Once checked, with the above changes I am getting as expected

` {"statusCode":200,"body":"{\"message\": \"hello world\"}"}`

AWS [says](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/edit-configuration-dialog.html) about this checkbox:

> This is useful if the function depends on packages that have natively compiled dependencies or programs

and this is essentially the same like running

`sam build --use-container` ([more](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-build.html))

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/system/32/2274_2.png) [@system](https://discuss.aerospike.com/u/system)\
**Post date:** [January 10, 2020, 5:43pm UTC](https://discuss.aerospike.com/t/errors-when-using-as-python-client-for-aws-lambda-with-sam-cli-on-ubuntu-18-04/7011/3 "2020-01-10T17:43:59Z")

</div>

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.
