Cannot import numba on AWS Lambda:'cannot import name '_typeconv' from 'numba.typeconv' (/mnt/access/numba/typeconv/__init__.py)'
See original GitHub issueI 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 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')
}
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just in case someone finds this I’ve posted a response on re:Post that you could use anaconda-project and s2i-anaconda-project to build docker images for AWS Lambda, which have entrypoint scripts for use as lambda functions
https://github.com/Anaconda-Platform/s2i-anaconda-project#entrypoints
Many thanks!