Home > Enterprise >  NumPy setup / import issue in lambda function
NumPy setup / import issue in lambda function

Time:02-13

Runtime python 3.7 w/ compatible runtime 3.7

I keep getting Import error when trying to test API in lambda function

PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n    https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n  * The Python version is: Python3.7 from \"/var/lang/bin/python3.7\"\n  * The NumPy version is: \"1.21.5\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: No module named 'numpy.core._multiarray_umath'\n",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []

I have tried adding numpy pip install inside docker, yet the issue still persists...

The dockfile engine used is amazonlinux:2

Any way of solving this weird issue?

CodePudding user response:

Based on the comments.

The solution was to use Numpy layer provided by AWS.

  • Related