Search code examples
pythonibm-cloudcloud-foundry

Bluemix and Python / Deploy Error after Platform Upgrade


I've made a fresh deploy (cf push) of a Bluemix application developed under Python 2.7 under the updated Bluemix base platform. The deploy shows an error at the Python PIP mechanism, which is the default package installer. Apparently the type of error might be related to a missing install of the openssl-devel package at OS level (SSL support).

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

Log:

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 [email protected] / espaço dev como [email protected] m.com... OK

Inicializando app oauthAqua1 na org [email protected] / 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

I am having the same issue when I use an older buildpack like https://github.com/cloudfoundry/cf-buildpack-python.git#v1.1.2


Solution

  • An important hint received from @chughts:
    I suspect that it is the stack that is catching you out. I think that the supported stack on Bluemix is now cf_linuxfs2. You will need to use a build pack that supports this stack.

    My fix:

    A new deploy with the latest Python buildpack fixed the issue:

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

    The crash message is solved. Thanks @chughts for your hint and support. Problem solved.