# AWS Lambda & wandb

**URL:** <https://community.wandb.ai/t/aws-lambda-wandb/5839>\
**Category:** W&B Help\
**Tags:** wandb\
**Created:** [February 4, 2024, 5:15am UTC](https://community.wandb.ai/t/aws-lambda-wandb/5839 "2024-02-04T05:15:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edsbks](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@edsbks](https://community.wandb.ai/u/edsbks)\
**Post date:** [February 4, 2024, 5:15am UTC](https://community.wandb.ai/t/aws-lambda-wandb/5839/1 "2024-02-04T05:15:17Z")

</div>

I have the following codes in my AWS lambda function and the error logs below. Error went away when wandb.init() is commented out.

I am using wandb 0.16.2 (as lambda layer) and python 3.11. I configured the environment variables printed below. I also tried 0.15.5 but resulted the same errors.

Any idea how to solve this?  
Is there a working sample hello world on wandb + AWS lambda?

==================================  
import wandb  
import sys  
import os

def lambda\_handler(event, context):

```
print("sys.executable = " + sys.executable)
print("WANDB__EXECUTABLE = " + os.environ['WANDB__EXECUTABLE'])
print("WANDB_CACHE_DIR = " + os.environ['WANDB_CACHE_DIR'])
print("WANDB_CONFIG_DIR = " + os.environ['WANDB_CONFIG_DIR'])
print("WANDB_DIR = " + os.environ['WANDB_DIR'])
print("WANDB_SILENT = " + os.environ['WANDB_SILENT'])

wandb.init()
.....

```

================================

Function Logs  
START RequestId: 77bbec50-e984-4339-a7ba-dd2b2b49df95 Version: $LATEST  
sys.executable = /var/lang/bin/python3.11  
WANDB\_\_EXECUTABLE = /var/lang/bin/python3.11  
WANDB\_CACHE\_DIR = /tmp/  
WANDB\_CONFIG\_DIR = /tmp/  
WANDB\_DIR = /tmp/  
WANDB\_SILENT = true  
wandb: WARNING Path /var/task/wandb/ wasn’t writable, using system temp directory.  
/var/lang/bin/python3.11: No module named wandb  
[ERROR] ServiceStartProcessError: The wandb service process exited with 1. Ensure that `sys.executable` is a valid python interpreter. You can override it with the `_executable` setting or with the `WANDB__EXECUTABLE` environment variable.  
Traceback (most recent call last):  
File “/var/task/lambda\_function.py”, line 45, in lambda\_handler  
wandb.init()  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_init.py”, line 1195, in init  
raise e  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_init.py”, line 1172, in init  
wi.setup(kwargs)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_init.py”, line 189, in setup  
self.\_wl = wandb\_setup.setup(settings=setup\_settings)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_setup.py”, line 327, in setup  
ret = \_setup(settings=settings)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_setup.py”, line 320, in \_setup  
wl = \_WandbSetup(settings=settings)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_setup.py”, line 303, in **init**  
\_WandbSetup.\_instance = \_WandbSetup\_\_WandbSetup(settings=settings, pid=pid)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_setup.py”, line 114, in **init**  
self.\_setup()  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_setup.py”, line 250, in \_setup  
self.\_setup\_manager()  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_setup.py”, line 277, in \_setup\_manager  
self.\_manager = wandb\_manager.\_Manager(settings=self.\_settings)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/wandb\_manager.py”, line 139, in **init**  
self.\_service.start()  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/service/service.py”, line 237, in start  
self.\_launch\_server()  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/service/service.py”, line 231, in \_launch\_server  
\_sentry.reraise(e)  
File “/opt/python/lib/python3.11/site-packages/wandb/analytics/sentry.py”, line 154, in reraise  
raise exc.with\_traceback(sys.exc\_info()[2])  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/service/service.py”, line 229, in \_launch\_server  
self.\_wait\_for\_ports(fname, proc=internal\_proc)  
File “/opt/python/lib/python3.11/site-packages/wandb/sdk/service/service.py”, line 107, in \_wait\_for\_ports  
raise ServiceStartProcessError(END RequestId: 77bbec50-e984-4339-a7ba-dd2b2b49df95  
REPORT RequestId: 77bbec50-e984-4339-a7ba-dd2b2b49df95 Duration: 845.17 ms Billed Duration: 846 ms Memory Size: 256 MB Max Memory Used: 228 MB Init Duration: 5442.98 ms

---

<div class="post-metadata">

**Author:** ![raphael-sanandres](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@raphael-sanandres](https://community.wandb.ai/u/raphael-sanandres)\
**Post date:** [February 6, 2024, 9:45pm UTC](https://community.wandb.ai/t/aws-lambda-wandb/5839/2 "2024-02-06T21:45:38Z")

</div>

Hello! This looks like an older issue that has resurfaced when running `wandb` in an AWS Lambda function. Could you try the suggestion [here](https://github.com/wandb/wandb/issues/5765#issuecomment-1602992091) in order to try to alleviate the issue?

---

<div class="post-metadata">

**Author:** ![edsbks](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@edsbks](https://community.wandb.ai/u/edsbks)\
**Post date:** [February 6, 2024, 10:46pm UTC](https://community.wandb.ai/t/aws-lambda-wandb/5839/3 "2024-02-06T22:46:12Z")

</div>

Thanks! I will try and update here…

---

<div class="post-metadata">

**Author:** ![raphael-sanandres](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@raphael-sanandres](https://community.wandb.ai/u/raphael-sanandres)\
**Post date:** [February 8, 2024, 5:18pm UTC](https://community.wandb.ai/t/aws-lambda-wandb/5839/4 "2024-02-08T17:18:56Z")

</div>

Sounds good! Let me know once you are able to try!
