Google应用引擎 - 缺少numpy.core.multiarray

4

我正在尝试从Google App Engine运行一个Web应用程序,该应用程序使用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

过去的三个版本在标准的Python脚本中运行良好,但在Web应用程序外部运行。也许与应用引擎不使用上述指定的numpy版本有关,而是使用内置版本1.6.1:https://cloud.google.com/appengine/docs/standard/python/tools/built-in-libraries-27 有什么解决方法吗?

3
在GAE标准环境中,您无法上传编译后的C代码,而numpy包含编译后的代码。 - new name
1个回答

3
请注意,Panda库在内部使用C语言编写,正如@JeffO'Neill在App Engine标准环境中所说,Python运行时环境的所有代码都必须是纯Python,不能包含任何需要C扩展或其他必须编译的代码的库。
然而,在App Engine灵活环境中没有限制,您可以使用C模块。

谢谢指点。我会研究使用App Engine flex来完成这个任务。 - James B

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接