【问题标题】:How do I use the latest version of pandas on Google App Engine Flexible如何在 Google App Engine Flexible 上使用最新版本的 pandas
【发布时间】:2021-12-30 15:34:56
【问题描述】:

我正在使用具有标准 Python 3 运行时的 Google App Engine Flexible。直到现在我一直在使用 pandas 1.0.5。我想开始使用 pandas 1.3.4。所以我更新了requirements.txt 并尝试部署到 GAE。我遇到了错误

Step #1: ERROR: Could not find a version that satisfies the requirement pandas==1.3.4 (from -r requirements.txt (line 16)) (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5)
Step #1: ERROR: No matching distribution found for pandas==1.3.4 (from -r requirements.txt (line 16))
Step #1: WARNING: You are using pip version 20.2.2; however, version 21.3.1 is available.
Step #1: You should consider upgrading via the '/env/bin/python -m pip install --upgrade pip' command.
Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Finished Step #1
ERROR

我看到它列出的最新 pandas 版本是 1.1.5,尽管 pandas 1.3.4 可用。

  1. GCloud 多久更新其标准运行时可用的软件包版本?

  2. 版本可用性是否与作为自定义运行时一部分的pip 版本相关?

  3. 有什么方法可以使用最新版本的包,而无需构建自定义运行时?

【问题讨论】:

  • 您使用的是什么版本的 Python? Pandas 1.3.4 需要 Python >=3.7.1。如果你的 python 不符合要求,GAE 可能会阻止安装
  • 我的 app.yaml 包含 python_version: 3。 GCloud docs (cloud.google.com/appengine/docs/flexible/python/runtime) 说这意味着 Python 3.7.2。
  • 当您尝试在本地计算机上运行此程序时会发生什么 - 您是否会收到关于 Pandas 的相同错误?
  • 同样的requirements.txt 文件可以正常工作。本地有 Python 3.8.3。
  • 尝试在```app.yaml``中设置runtime: python38

标签: python pandas google-app-engine app-engine-flexible


【解决方案1】:

我原来的app.yamlpython_version: 3。 Google Cloud 文档here 声明app.yaml 中的python_version: 3 指的是Python 3.7.2。但是,构建日志包含一行 RUN virtualenv --no-download /env -p python3.6

解决方案: 将配置更改为python_version: 3.7。现在构建日志中的相应行显示RUN virtualenv --no-download /env -p python3.7

【讨论】:

  • QQ(快速提问):您为什么使用 App Engine Flexible? (Google 建议您在大多数用例中使用 App Engine Standard,并且仅在您有特殊需求(例如自定义运行时、拥有自己的 Docker 容器等)时才使用 Flexible。)App Engine Standard 完全支持 Pandas,并且不会受到“奇怪”(也不是很长的部署时间),正如我在另一个 SO Q&A 中回答的那样:stackoverflow.com/a/69820884/305689
  • WRT(关于)版本号:这是为您指定的 python_version 部署的内容:a) Python 2.7.122 指定(默认,如果 python_version 未提供),b) Python 3.6.103 指定,c) Python 3.4.8 由 3.4 指定,d) Python 3.7.93.7 指定。添加到我之前的“QQ”评论:您还可以使用Cloud Run 作为 App Engine Flexible 的另一种替代方案,尤其是。如果你有 Docker 容器/Dockerfile.
  • @wescpy 1. 我还不需要自定义运行时。我也没有容器化我的应用程序。但是,我确实需要能够为应用程序指定 CPU 和 RAM。 GAE Standard instances 的规格不足以满足我的应用程序。这就是我必须使用 GAE Flexible 的原因。 2. 感谢更新。您是从一些官方文档还是通过您自己的实验获得这些结果的? Google 的文档页面仍然只列出了我之前看到的 2 个选项,即 (2->2.7.9; 3->3.7.2)。
猜你喜欢
  • 2021-11-20
  • 1970-01-01
  • 1970-01-01
  • 2018-08-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-10
  • 2017-12-07
相关资源
最近更新 更多