gpt4 book ai didi

python-3.x - Google App Engine 部署失败,因为在工作区中找不到 requirements.txt 文件

转载 作者:太空宇宙 更新时间:2023-11-03 15:36:01 25 4
gpt4 key购买 nike

有没有人收到“Step #1 - “builder”: IOError: [Errno 2] No such file or directory: "/workspace/requirements.txt -t lib/' to install these dependencies\r"' 错误尝试将 python37 应用程序部署到 Google App Engine?

我正在尝试使用 python 37 标准运行时部署我的网络应用程序,并收到以下构建错误:

Step #1 - "builder": IOError: [Errno 2] No such file or directory: "/workspace/requirements.txt -t lib/' to install these dependencies\r"
Finished Step #1 - "builder"
ERROR

我仔细检查了 requirements.txt 文件是否与 main.py 脚本位于同一目录中,根据日志的内容,似乎 requirements.txt 文件是在部署时读入的,但随后在工作区中找不到文件。

我正在从虚拟环境进行部署,并确保在虚拟环境中运行“pip install -r requirements.txt”命令,但是当我部署时它仍然在日志中给出相同的错误。以下是 app.yaml 文件内容的副本和部分日志。

app.yaml 文件

runtime: python37

instance_class: B8
basic_scaling:
max_instances: 1
idle_timeout: 1m

handlers:
- url: /.*
script: auto

日志:

Step #1 - "builder": # This requirements file lists all third-party 
dependencies for this project.
Step #1 - "builder": #
Step #1 - "builder": # Run 'pip install -r requirements.txt -t lib/' to
install these dependencies
Step #1 - "builder": # in `lib/` subdirectory.
Step #1 - "builder": #
Step #1 - "builder": # Note: The `lib` directory is added to `sys.path` by `appengine_config.py`.
Step #1 - "builder": flask==1.0.2
Step #1 - "builder": flask-restful==0.3.6
Step #1 - "builder": firebase-admin==2.14.0
Step #1 - "builder": pandas==0.23.4
Step #1 - "builder": datetime==4.3
Step #1 - "builder": google.auth==1.6.2
Step #1 - "builder": google.cloud==0.34.0
Step #1 - "builder": google-cloud-pubsub==0.39.0
Step #1 - "builder": dfply==0.3.3
Step #1 - "builder": requests==2.21.0
Step #1 - "builder": gunicorn
Step #1 - "builder":
Step #1 - "builder": INFO found recursive python requirements file: requirements.txt -t lib/' to install these dependencies
Step #1 - "builder": INFO checking_cached_requirements.txt_layer took 0 seconds
Step #1 - "builder": INFO build process for FTL image took 0 seconds
Step #1 - "builder": INFO full build took 0 seconds
Step #1 - "builder": Traceback (most recent call last):
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder": "__main__", fname, loader, pkg_name)
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder": exec code in run_globals
Step #1 - "builder": File "/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder": File "/ftl.par/__main__.py", line 54, in main
Step #1 - "builder": File "/ftl.par/__main__/ftl/python/builder.py", line 114, in Build
Step #1 - "builder": File "/ftl.par/__main__/ftl/python/layer_builder.py", line 116, in BuildLayer
Step #1 - "builder": File "/ftl.par/__main__/ftl/common/single_layer_image.py", line 60, in GetCacheKey
Step #1 - "builder": File "/ftl.par/__main__/ftl/python/layer_builder.py", line 107, in GetCacheKeyRaw
Step #1 - "builder": File "/ftl.par/__main__/ftl/common/ftl_util.py", line 168, in descriptor_parser
Step #1 - "builder": File "/ftl.par/__main__/ftl/common/context.py", line 80, in GetFile
Step #1 - "builder": IOError: [Errno 2] No such file or directory: "/workspace/requirements.txt -t lib/' to install these dependencies\r"
Finished Step #1 - "builder"
ERROR

最佳答案

我花了一段时间才弄明白,但在工作空间中找不到 requirements.txt 文件的原因是由于 .txt 文件中的 header 被注释掉了,当然它不是 python脚本,以便注释阻止文件被正确读取。

一旦我删除了任何注释并仅保留包名称,它就会正确部署。

关于python-3.x - Google App Engine 部署失败,因为在工作区中找不到 requirements.txt 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53878059/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com