【问题标题】:Google App Engine - missing numpy.core.multiarrayGoogle App Engine - 缺少 numpy.core.multiarray
【发布时间】:2018-03-23 08:58:36
【问题描述】:

我正在尝试从 Google App Engine 运行一个网络应用程序,该应用程序使用 pandas-gbq 访问 bigquery。这是我构建和运行应用程序时的错误:

ImportError:
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.
Original error was: No module named numpy.core.multiarray

我的 requirements.txt 文件有

google-api-python-client==1.6.5
google-auth==1.4.1
google-auth-httplib2==0.0.3
numpy==1.14.2
pandas==0.22.0
pandas-gbq==0.3.1

最后 3 个版本的这些版本可以在标准 Python 脚本中的 Web 应用程序之外正常工作。也许这与应用引擎没有使用上面指定的 numpy 版本有关,而是使用内置版本 1.6.1:https://cloud.google.com/appengine/docs/standard/python/tools/built-in-libraries-27

关于如何解决此问题的任何提示?

【问题讨论】:

  • GAE标准环境下无法上传编译好的C代码,numpy有编译好的代码。

标签: python numpy google-app-engine google-bigquery


【解决方案1】:

请注意,Panda 库在内部使用 C,就像 @JeffO'Neill 在 App Engine 标准环境中所说的那样,Python 运行时环境的所有代码都必须是 pure Python,并且它不能包含任何需要 C 扩展或其他代码的库必须编译。

但是,App Engine Flexible Environment 没有限制,您可以使用 C 模块。

【讨论】:

  • 感谢您的指点。我将考虑为此使用 App Engine flex
猜你喜欢
  • 2013-05-09
  • 2014-01-17
  • 1970-01-01
  • 2012-02-21
  • 1970-01-01
  • 1970-01-01
  • 2012-01-27
  • 2018-06-08
  • 2014-03-17
相关资源
最近更新 更多