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