question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import numba on AWS Lambda:'cannot import name '_typeconv' from 'numba.typeconv' (/mnt/access/numba/typeconv/__init__.py)'

See original GitHub issue

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 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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
AlbertDeFuscocommented, Apr 13, 2022

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

0reactions
gmarkallcommented, Apr 12, 2022

Many thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found