I have an AWS Lambda function with Python 3.7 runtime and AWSLambda-Python37-SciPy1x lambda layer added.
I have my python dependencies (such as numba) installed on a EFS directory that I add to the path that the Lambda function can access.
(I installed numba with pip install --target . numba==0.47.0
, for version 0.47.0, for example)
I can inport numpy, but trying to import numba gives the following error:
Runtime.ImportModuleError: Unable to import module 'lambda_function': Numba could not be imported.
If you are seeing this message and are undertaking Numba development work, you may need to re-run:
python setup.py build_ext --inplace
(Also, please check the development set up guide http://numba.pydata.org/numba-doc/latest/developer/contributing.html.)
If you are not working on Numba development:
Please report the error message and traceback, along with a minimal reproducer
at: https://github.com/numba/numba/issues/new
If more help is needed please feel free to speak to the Numba core developers
directly at: https://gitter.im/numba/numba
Thanks in advance for your help in improving Numba!
The original error was: 'cannot import name '_typeconv' from 'numba.typeconv' (/mnt/access/numba/typeconv/__init__.py)'
--------------------------------------------------------------------------------
If possible please include the following in your error report:
sys.executable: /var/lang/bin/python3.7
Traceback (most recent call last):
I tried with the numba versions 0.45.0, 0.47.0, 0.48.0, 0.49.0, 0.49.1, 0.55.1 and the error is the same in all versions.
I saw this response, but when I delete de numba files from the EFS directory, i get a No module named 'numba' error, which indicates that there is no other numba version installed.
Below is the full code of the AWS Lambda function:
import sys
sys.path.append("/mnt/access")
import os, json, sys
import numba
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': json.dumps('All OK')
}
Is there a specific way I should be installing numba?
*ps:
I describe this exact problem in this issue on the numba repository, but unfortunately the numba mainteiners do not have familiarity with aws lambda, so I coundn't get help.
Any solution to-date?