在AWS Lambda上运行时导入多数组numpy扩展模块失败

时间:2019-02-07 16:59:16

标签: python numpy aws-lambda

我正在尝试在AWS Lambda实例上运行Tensorflow。尝试
import numpy as np

我收到此错误消息:

File "/var/task/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
File "/var/task/numpy/core/multiarray.py", line 12, in <module>
from . import overrides
File "/var/task/numpy/core/overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using %s),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

我正在将整个功能(以及库)部署到S3的.zip文件中。 使用

将Numpy安装在virtualenv中

python -m virtualenv .
pip install numpy

尝试使用pip install --upgrade --force-reinstall numpy,但看起来像Numpy,这是最新版本-1.16.1 我的机器和AWS Lambda上都具有Python版本-3.6.8
本地计算机(正在执行-m virtualenvpip install的计算机运行Windows 10

还弄清楚,问题完全出在import numpy as np,而不是import tensorflow as tf。指出这一点,因为与此主题相关的其他一些问题也包含该问题。

0 个答案:

没有答案