Search code examples
pythonaws-lambdanumbasuppress-warnings

Numba issues multiprocessing UserWarning when running in AWS Lambda


When running a script with numba on AWS Lambda, I always get this warning:

/var/task/numba/npyufunc/parallel.py:300: UserWarning: Could not obtain multiprocessing lock due to OS level error: Errno 38] Function not implemented

Since AWS Lambda does not support multiprocessing, is there any way to ignore this error?


Solution

  • Add this code to the python file where your lambda handle is imported:

    import warnings
    warnings.filterwarnings(action='ignore', message='Could not obtain multiprocessing lock')
    

    This will ignore that specific warning, while still printing any other warnings your script may produce.