平台升级后 Bluemix 和 Python / 部署错误

Bluemix and Python / Deploy Error after Platform Upgrade

我在更新的 Bluemix 基础平台下对在 Python 2.7 下开发的 Bluemix 应用程序进行了全新部署(cf push)。部署在 Python PIP 机制中显示错误,这是默认的包安装程序。显然,错误类型可能与缺少 OS 级别(SSL 支持)的 openssl-devel 软件包安装有关。

Error message: ValueError: unsupported hash type md5 
Error message: ImportError: No module named 'pip._vendor.requests'

日志:

cf push oauthAqua1 -m 64M -b "https://github.com/cloudfoundry/cf-buildpack-python.git" -c "python ssl_server.py"

Enviando oauthAqua1... Enviando app com arquivos do caminho: C:\mobile\myprojects\oauth Enviando 231.6K, 37 arquivos OK

Parando app oauthAqua1 na org claudef@br.ibm.com / espaço dev como claudef@br.ib m.com... OK

Inicializando app oauthAqua1 na org claudef@br.ibm.com / espaço dev como claudef @br.ibm.com... OK -----> Downloaded app package (132K) -----> Downloaded app buildpack cache (27M) Cloning into '/tmp/buildpacks/cf-buildpack-python'... Submodule 'compile-extensions' (https://github.com/cloudfoundry/compile-exte nsions.git) registered for path 'compile-extensions' Cloning into 'compile-extensions'... Submodule path 'compile-extensions': checked out 'b5e0cf7be729718d162d56709ec7f2 7d34e68c7c' -------> Buildpack version 1.5.1 ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[__func_name] = __get_hash(__func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 ERROR:root:code for hash sha1 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha1 ERROR:root:code for hash sha224 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha224 ERROR:root:code for hash sha256 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha256 ERROR:root:code for hash sha384 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha384 ERROR:root:code for hash sha512 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha512 Traceback (most recent call last): File "/app/.heroku/python/bin/pip", line 9, in load_entry_point('pip==6.0.6', 'console_scripts', 'pip')() File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 519, in lo ad_entry_point File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 2630, in l oad_entry_point File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 2310, in l oad File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 2316, in r esolve File "/app/.heroku/python/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg/pip/ init.py", line 15, in from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/app/.heroku/python/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg/pip/ vcs/mercurial.py", line 11, in from pip.download import path_to_url File "/app/.heroku/python/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg/pip/ download.py", line 30, in from pip.vendor import requests, six File "/app/.heroku/python/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg/pip/ vendor/init.py", line 81, in load_module raise ImportError("No module named '%s'" % (name,)) ImportError: No module named 'pip.vendor.requests' ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in _get_builtin constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 ERROR:root:code for hash sha1 was not found. Traceback (most recent call last): File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in globals()[func_name] = get_hash(func_name) File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in _get_builtin _constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type sha1

FALHA Erro no servidor, código de resposta: 400, código de erro: 170004, mensagem: App staging failed in the buildpack compile phase

DICA: utilize 'cf logs oauthAqua1 --recent' para maiores informações ... 2015-10-30T18:38:02.17-0200 [STG] ERR from .ssl_ import ( 2015-10-30T18:38:02.17-0200 [STG] ERR File "/app/.heroku/python/lib/pytho 2.7/site-packages/pip-7.1.0-py2.7.egg/pip/vendor/requests/packages/urllib3/uti /ssl.py", line 2, in 2015-10-30T18:38:02.17-0200 [STG] ERR from hashlib import md5, sha1, sh 256 2015-10-30T18:38:02.17-0200 [STG] ERR ImportError: cannot import name md5 2015-10-30T18:38:02.20-0200 [STG] OUT Staging failed: Buildpack compilation step failed 2015-10-30T18:38:02.42-0200 [API] ERR encountered error: App staging failed in the buildpack compile phase

当我使用像 https://github.com/cloudfoundry/cf-buildpack-python.git#v1.1.2

这样的旧构建包时,我遇到了同样的问题

来自@chughts 的重要提示:
我怀疑是堆栈让你出局了。我认为 Bluemix 上支持的堆栈现在是 cf_linuxfs2。您将需要使用支持此堆栈的构建包。

我的修复:

使用最新 Python buildpack 的新部署修复了问题:

cf push myapp1 -m 64M -b "https://github.com/cloudfoundry/cf-buildpack-python.git#v1.5.1" -c "python server.py"

崩溃信息已解决。感谢@chughts 的提示和支持。问题已解决。