首页 > 解决方案 > 部署到 gcloud 会产生可怕的构建错误

问题描述

长话短说,我正在将 django 应用程序部署到应用程序引擎。构建过程似乎安装了许多软件包,然后出现错误,就像这样。

编辑。这是(编辑的)构建日志。的命令行输出gcloud app deploy位于下方。

(((redacted, everything up to this point builds successfully)))
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmp1IKuwt/env /tmp/tmpDGYffm/wheel/aldryn_apphooks_config-0.5.3-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/aldryn_apphooks_config-0.5.3-py2.py3-none-any.whl
Step #1 - "builder": Installing collected packages: aldryn-apphooks-config
Step #1 - "builder": Successfully installed aldryn-apphooks-config-0.5.3
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmpwuKmD2/env /tmp/tmpDGYffm/wheel/cryptography-2.8-cp34-abi3-manylinux2010_x86_64.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/cryptography-2.8-cp34-abi3-manylinux2010_x86_64.whl
Step #1 - "builder": Installing collected packages: cryptography
Step #1 - "builder": Successfully installed cryptography-2.8
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmp85xugM/env /tmp/tmpDGYffm/wheel/gunicorn-20.0.4-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/gunicorn-20.0.4-py2.py3-none-any.whl
Step #1 - "builder": Installing collected packages: gunicorn
Step #1 - "builder": Successfully installed gunicorn-20.0.4
Step #1 - "builder": 
Step #1 - "builder": INFO     `pip_install_from_wheels` had stderr output:
Step #1 - "builder":   WARNING: The script gunicorn is installed in '/tmp/tmp85xugM/env/bin' which is not on PATH.
Step #1 - "builder":   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmpwrJu3c/env /tmp/tmpDGYffm/wheel/pycparser-2.19-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/pycparser-2.19-py2.py3-none-any.whl
Step #1 - "builder": Installing collected packages: pycparser
Step #1 - "builder": Successfully installed pycparser-2.19
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmpnObJ5s/env /tmp/tmpDGYffm/wheel/queuelib-1.5.0-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/queuelib-1.5.0-py2.py3-none-any.whl
Step #1 - "builder": Installing collected packages: queuelib
Step #1 - "builder": Successfully installed queuelib-1.5.0
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmpPvXJiN/env /tmp/tmpDGYffm/wheel/tzlocal-2.0.0-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/tzlocal-2.0.0-py2.py3-none-any.whl
Step #1 - "builder": Installing collected packages: tzlocal
Step #1 - "builder": Successfully installed tzlocal-2.0.0
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmpVNLN0Z/env /tmp/tmpDGYffm/wheel/pip-20.1-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": Processing /tmp/tmpDGYffm/wheel/pip-20.1-py2.py3-none-any.whl
Step #1 - "builder": Installing collected packages: pip
Step #1 - "builder":   Found existing installation: pip 19.2.3
Step #1 - "builder":     Uninstalling pip-19.2.3:
Step #1 - "builder":       Successfully uninstalled pip-19.2.3
Step #1 - "builder": Successfully installed pip-20.1
Step #1 - "builder": 
Step #1 - "builder": INFO     pip_install_from_wheels took 1 seconds
Step #1 - "builder": INFO     starting: pip_install_from_wheels
Step #1 - "builder": INFO     pip_install_from_wheels /env/bin/python3.7 -m pip install --no-deps --prefix /tmp/tmptNKyMq/env /tmp/tmpDGYffm/wheel/pyasn1-0.4.8-py2.py3-none-any.whl --disable-pip-version-check
Step #1 - "builder": INFO     `pip_install_from_wheels` stdout:
Step #1 - "builder": 
Step #1 - "builder": INFO     `pip_install_from_wheels` had stderr output:
Step #1 - "builder": /env/bin/python3.7: No module named pip
Step #1 - "builder": 
Step #1 - "builder": ERROR    error: `pip_install_from_wheels` returned code: 1
Step #1 - "builder": INFO     pip_install_from_wheels took 0 seconds
Step #1 - "builder": INFO     build process for FTL image took 45 seconds
Step #1 - "builder": INFO     full build took 45 seconds
Step #1 - "builder": ERROR    `pip_install_from_wheels` had stderr output:
Step #1 - "builder": /env/bin/python3.7: No module named pip
Step #1 - "builder": 
Step #1 - "builder": error: `pip_install_from_wheels` returned code: 1
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 "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__.py", line 60, in main
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__/ftl/common/ftl_error.py", line 77, in InternalErrorHandler
Step #1 - "builder": IOError: [Errno 2] No such file or directory: '""/output'
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/python37_app_builder:python37_20200405_3_7_7_RC00" failed: step exited with non-zero status: 1

如您所见,这非常令人困惑。/env/bin/python3.7: No module named pip? 似乎是应用引擎构建过程中的一个问题。

这是命令的输出gcloud app deploy

ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 168573b7-17ed-4bb8-a92d-8cdf7b9ca751 status: FAILURE.                                                          Build error details: {
{
    "error": {
        "errorType": "BuildError",
        "canonicalCode": "INVALID_ARGUMENT",
        "errorId": "D2E1945E",
        "errorMessage": "14 May 2020 04:28:03 INFO     Arguments: ['--parser_script=/usr/local/bin/ftl.par', '--src=', '--entrypoint=', '--name=us.gcr.io/gae-cms-277200/app-engine-tmp/app/ttl-2h:b073c253-b4db-4dbf-afef-0bd8a2ac8ccc', '--directory=/workspace', '--destination=/srv', '--cache-repository=us.gcr.io/gae-cms-277200/app-engine-tmp/build-cache/ttl-7d', '--cache', '--builder-output-path=\"\"', '--additional-directory=/.googleconfig', '--python-cmd=/opt/python3.7/bin/python3.7', '--pip-cmd=/env/bin/python3.7 -m pip', '--venv-cmd=/opt/python3.7/bin/python3.7 -m venv /env', '-v=DEBUG', '--base=us.gcr.io/gae-runtimes/python37:python37_20200405_3_7_7_RC00']\n14 May 2020 04:28:03 INFO     Unparsed arguments: ['--name=us.gcr.io/gae-cms-277200/app-engine-tmp/app/ttl-2h:b073c253-b4db-4dbf-afef-0bd8a2ac8ccc', '--directory=/workspace', '--destination=/srv', '--cache-repository=us.gcr.io/gae-cms-277200/app-engine-tmp/build-cache/ttl-7d', '--cache', '--builder-output-path=\"\"', '--additional-directory=/.googleconfig', '--python-cmd=/opt/python3.7/bin/python3.7', '--pip-cmd=/env/bin/python3.7 -m pip', '--venv-cmd=/opt/python3.7/bin/python3.7 -m venv /env', '-v=DEBUG', '--base=us.gcr.io/gae-runtimes/python37:python37_20200405_3_7_7_RC00']\n14 May 2020 04:28:03 INFO     Executing ['/usr/local/bin/ftl.par', '--name=us.gcr.io/gae-cms-277200/app-engine-tmp/app/ttl-2h:b073c253-b4db-4dbf-afef-0bd8a2ac8ccc', '--directory=/workspace', '--destination=/srv', '--cache-repository=us.gcr.io/gae-cms-277200/app-engine-tmp/build-cache/ttl-7d', '--cache', '--builder-output-path=\"\"', '--additional-directory=/.googleconfig', '--python-cmd=/opt/python3.7/bin/python3.7', '--pip-cmd=/env/bin/python3.7 -m pip', '--venv-cmd=/opt/python3.7/bin/python3.7 -m venv /env', '-v=DEBUG', '--base=us.gcr.io/gae-runtimes/python37:python37_20200405_3_7_7_RC00']\nINFO     FTL version python-v0.17.0\nINFO     Beginning FTL build for python\nINFO     FTL arg passed: virtualenv_dir /env\nINFO     FTL arg passed: ttl 168\nINFO     FTL arg passed: python_cmd /opt/python3.7/bin/python3.7\nINFO     FTL arg passed: cache True\nINFO     FTL arg passed: virtualenv_cmd virtualenv\nINFO     FTL arg passed: entrypoint None\nINFO     FTL arg passed: exposed_ports None\nINFO     FTL arg passed: pip_cmd /env/bin/python3.7 -m pip\nINFO     FTL arg passed: tar_base_image_path None\nINFO     FTL arg passed: export_cache_stats False\nINFO     FTL arg passed: builder_output_path \"\"\nINFO     FTL arg passed: destination_path /srv\nINFO     FTL arg passed: sh_c_prefix False\nINFO     FTL arg passed: base us.gcr.io/gae-runtimes/python37:python37_20200405_3_7_7_RC00\nINFO     FTL arg passed: cache_key_version v0.17.0\nINFO     FTL arg passed: cache_salt \nINFO     FTL arg passed: cache_repository us.gcr.io/gae-cms-277200/app-engine-tmp/build-cache/ttl-7d\nINFO     FTL arg passed: venv_cmd /opt/python3.7/bin/python3.7 -m venv /env\nINFO     FTL arg passed: name us.gcr.io/gae-cms-277200/app-engine-tmp/app/ttl-2h:b073c253-b4db-4dbf-afef-0bd8a2ac8ccc\nINFO     FTL arg passed: global_cache False\nINFO     FTL arg passed: upload True\nINFO     FTL arg passed: fail_on_error True\nINFO     FTL arg passed: output_path None\nINFO     FTL arg passed: directory /workspace\nINFO     FTL arg passed: additional_directory /.googleconfig\nINFO     FTL arg passed: verbosity DEBUG\nINFO     starting: full build\nINFO     starting: builder initialization\nINFO     Loading Docker credentials for repository 'us.gcr.io/gae-runtimes/python37:python37_20200405_3_7_7_RC00'\nINFO     Loading Docker credentials for repository 'us.gcr.io/gae-cms-277200/app-engine-tmp/app/ttl-2h:b073c253-b4db-4dbf-afef-0bd8a2ac8ccc'\nINFO     builder initialization took 0 seconds\nINFO     starting: build process for FTL image\nINFO     starting: checking_cached_interpreter_layer\nINFO     starting: check python version\nINFO     `python version` full cmd:\n/opt/python3.7/bin/python3.7 --version\nINFO     `python version` stderr:\n\nINFO     check pyt."
    }
}

编辑。很抱歉该错误消息的格式!

任何有关如何调试此问题的建议将不胜感激。

编辑。我相信解决方案是从 python 36 升级到 37,如app.yaml. 我将继续工作并发布更新。

标签: gcloud

解决方案


我们没有看到您的requirements.txt文件,但是这个问题已经出现了。如果你看看这里这里,你会找到解决办法。我知道它们已经过时了,但是如果你采取类似的方法,你应该很容易处理它。

我希望它会有所帮助!


推荐阅读