Description
I'm deploying an AWS Lambda Function to an edge device with IoT GreenGrass, when my function runs it has a problem with my import pandas
requirement giving an error related to numpy.
See this thread on the AWS GreenGrass forums
Reproducing code example:
import pandas as pd
(Numpy is a dependency of pandas)
I've written this using the AWS Toolkit for PyCharm, inside that there's a requirements.txt file listing numpy and pandas. The SAM build process has been set to complete in a container so as to avoid using numpy/pandas compiled for Windows.
Error message:
Here's the log file:
[2019-09-17T11:20:04.778+01:00][FATAL]-lambda_runtime.py:131,Failed to import handler function "doGreenGrassPredictions.function_handler" due to exception: Unable to import required dependencies:
[2019-09-17T11:20:04.778+01:00][FATAL]-numpy:
[2019-09-17T11:20:04.778+01:00][FATAL]-IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
[2019-09-17T11:20:04.778+01:00][FATAL]-Importing the numpy c-extensions failed.
[2019-09-17T11:20:04.778+01:00][FATAL]-- Try uninstalling and reinstalling numpy.
[2019-09-17T11:20:04.778+01:00][FATAL]-- If you have already done that, then:
[2019-09-17T11:20:04.778+01:00][FATAL]- 1. Check that you expected to use Python3.7 from "/usr/bin/python3.7",
[2019-09-17T11:20:04.778+01:00][FATAL]- and that you have no directories in your PATH or PYTHONPATH that can
[2019-09-17T11:20:04.778+01:00][FATAL]- interfere with the Python and numpy version "1.17.2" you're trying to use.
[2019-09-17T11:20:04.778+01:00][FATAL]- 2. If (1) looks fine, you can open a new issue at
[2019-09-17T11:20:04.778+01:00][FATAL]- https://github.com/numpy/numpy/issues. Please include details on:
[2019-09-17T11:20:04.778+01:00][FATAL]- - how you installed Python
[2019-09-17T11:20:04.778+01:00][FATAL]- - how you installed numpy
[2019-09-17T11:20:04.778+01:00][FATAL]- - your operating system
[2019-09-17T11:20:04.778+01:00][FATAL]- - whether or not you have multiple versions of Python installed
[2019-09-17T11:20:04.778+01:00][FATAL]- - if you built from source, your compiler versions and ideally a build log
[2019-09-17T11:20:04.778+01:00][FATAL]-- If you're working with a numpy git repository, try `git clean -xdf`
[2019-09-17T11:20:04.778+01:00][FATAL]- (removes all files not under version control) and rebuild numpy.
[2019-09-17T11:20:04.778+01:00][FATAL]-Note: this error has many possible causes, so please don't comment on
[2019-09-17T11:20:04.778+01:00][FATAL]-an existing issue about this - open a new one instead.
[2019-09-17T11:20:04.778+01:00][FATAL]-Original error was: No module named 'numpy.core._multiarray_umath'
[2019-09-17T11:20:04.779+01:00][FATAL]-lambda_runtime.py:371,Failed to initialize Lambda runtime due to exception: Unable to import required dependencies:
[2019-09-17T11:20:04.779+01:00][FATAL]-numpy:
[2019-09-17T11:20:04.779+01:00][FATAL]-IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
[2019-09-17T11:20:04.779+01:00][FATAL]-Importing the numpy c-extensions failed.
[2019-09-17T11:20:04.779+01:00][FATAL]-- Try uninstalling and reinstalling numpy.
[2019-09-17T11:20:04.779+01:00][FATAL]-- If you have already done that, then:
[2019-09-17T11:20:04.779+01:00][FATAL]- 1. Check that you expected to use Python3.7 from "/usr/bin/python3.7",
[2019-09-17T11:20:04.779+01:00][FATAL]- and that you have no directories in your PATH or PYTHONPATH that can
[2019-09-17T11:20:04.779+01:00][FATAL]- interfere with the Python and numpy version "1.17.2" you're trying to use.
[2019-09-17T11:20:04.779+01:00][FATAL]- 2. If (1) looks fine, you can open a new issue at
[2019-09-17T11:20:04.779+01:00][FATAL]- https://github.com/numpy/numpy/issues. Please include details on:
[2019-09-17T11:20:04.779+01:00][FATAL]- - how you installed Python
[2019-09-17T11:20:04.779+01:00][FATAL]- - how you installed numpy
[2019-09-17T11:20:04.779+01:00][FATAL]- - your operating system
[2019-09-17T11:20:04.779+01:00][FATAL]- - whether or not you have multiple versions of Python installed
[2019-09-17T11:20:04.779+01:00][FATAL]- - if you built from source, your compiler versions and ideally a build log
[2019-09-17T11:20:04.779+01:00][FATAL]-- If you're working with a numpy git repository, try `git clean -xdf`
[2019-09-17T11:20:04.779+01:00][FATAL]- (removes all files not under version control) and rebuild numpy.
[2019-09-17T11:20:04.779+01:00][FATAL]-Note: this error has many possible causes, so please don't comment on
[2019-09-17T11:20:04.779+01:00][FATAL]-an existing issue about this - open a new one instead.
[2019-09-17T11:20:04.779+01:00][FATAL]-Original error was: No module named 'numpy.core._multiarray_umath'
[2019-09-17T11:20:18.818+01:00][FATAL]-lambda_runtime.py:131,Failed to import handler function "doGreenGrassPredictions.function_handler" due to exception: Missing required dependencies ['numpy']
[2019-09-17T11:20:18.819+01:00][FATAL]-lambda_runtime.py:371,Failed to initialize Lambda runtime due to exception: Missing required dependencies ['numpy']
[2019-09-17T11:20:20.21+01:00][FATAL]-lambda_runtime.py:131,Failed to import handler function "doGreenGrassPredictions.function_handler" due to exception: Missing required dependencies ['numpy']
[2019-09-17T11:20:20.211+01:00][FATAL]-lambda_runtime.py:371,Failed to initialize Lambda runtime due to exception: Missing required dependencies ['numpy']
Numpy/Python version information:
Python 3.7
Numpy version unknown since I cannot import numpy to print its version.
It's quite possible this error is related to some proprietary gubbins Amazon is doing, between deploying it with SAM (Serverless Application Model) and then deploying it to an IoT device with IoT GreenGrass, perhaps some weird stuff has happened. I've created this issue so I can link to it in a bug report to Amazon.