Search code examples
pythonflaskibm-cloud

Bluemix flask app not building any more


I have a flask app on bluemix. It worked perfectly. I changed some text in one of my htmls (shouldn't have anything to do with it).

Hadn't checked it for a while, but seems like it suddenly doesn't build (stops after restarting)

The log:

2016-05-09T12:46:48.314+0200[API/1]OUTUpdated app with guid 4ff2a7a5-9b2f-41c4-85db-282b44ad6e3e ({"state"=>"STOPPED"})
2016-05-09T12:46:50.535+0200[DEA/209]OUTGot staging request for app with id 4ff2a7a5-9b2f-41c4-85db-282b44ad6e3e
2016-05-09T12:46:57.612+0200[API/6]OUTUpdated app with guid 4ff2a7a5-9b2f-41c4-85db-282b44ad6e3e ({"state"=>"STARTED"})
2016-05-09T12:46:57.788+0200[STG/209]OUT-----> Downloaded app package (372K)
2016-05-09T12:47:00.352+0200[STG/209]OUT-----> Downloaded app buildpack cache (54M)
2016-05-09T12:47:01.138+0200[STG/0]OUT-------> Buildpack version 1.5.2
2016-05-09T12:47:10.018+0200[STG/0]OUT-----> Installing dependencies with pip
2016-05-09T12:47:10.424+0200[STG/0]OUT Collecting setuptools>=18.5 (from ipython->pandas-highcharts==0.5.2->-r requirements.txt (line 5))
2016-05-09T12:47:11.027+0200[STG/0]OUT Downloading setuptools-21.0.0-py2.py3-none-any.whl (509kB)
2016-05-09T12:47:11.160+0200[STG/0]OUT Found existing installation: setuptools 18.3.2
2016-05-09T12:47:11.160+0200[STG/0]OUT Installing collected packages: setuptools
2016-05-09T12:47:11.162+0200[STG/0]OUT Uninstalling setuptools-18.3.2:
2016-05-09T12:47:11.181+0200[STG/0]OUT Successfully uninstalled setuptools-18.3.2
2016-05-09T12:47:11.429+0200[STG/0]OUT Successfully installed setuptools

(from here they are red)

2016-05-09T12:47:11.444+0200[STG/0]ERRTraceback (most recent call last):
2016-05-09T12:47:11.444+0200[STG/0]ERR load_entry_point('pip==7.1.2', 'console_scripts', 'pip')()
2016-05-09T12:47:11.444+0200[STG/0]ERR File "/app/.heroku/python/bin/pip", line 9, in <module>
2016-05-09T12:47:11.445+0200[STG/0]ERR return command.main(cmd_args)
2016-05-09T12:47:11.445+0200[STG/0]ERR pip_version_check(session)
2016-05-09T12:47:11.444+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/__init__.py", line 217, in main
2016-05-09T12:47:11.445+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/outdated.py", line 102, in pip_version_check
2016-05-09T12:47:11.445+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 248, in main
2016-05-09T12:47:11.445+0200[STG/0]ERR installed_version = get_installed_version("pip")
2016-05-09T12:47:11.445+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 858, in get_installed_version
2016-05-09T12:47:11.445+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 629, in __init__
2016-05-09T12:47:11.445+0200[STG/0]ERR self.add_entry(entry)
2016-05-09T12:47:11.445+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 685, in add_entry
2016-05-09T12:47:11.445+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2075, in find_eggs_in_zip
2016-05-09T12:47:11.446+0200[STG/0]ERR return self.egg_info and self._has(self._fn(self.egg_info, name))
2016-05-09T12:47:11.446+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1605, in has_metadata
2016-05-09T12:47:11.445+0200[STG/0]ERR working_set = pkg_resources.WorkingSet()
2016-05-09T12:47:11.447+0200[STG/0]ERR return zip_path in self.zipinfo or zip_path in self._index()
2016-05-09T12:47:11.447+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1843, in zipinfo
2016-05-09T12:47:11.446+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1963, in _has
2016-05-09T12:47:11.447+0200[STG/0]ERR return self._zip_manifests.load(self.loader.archive)
2016-05-09T12:47:11.445+0200[STG/0]ERR for dist in find_distributions(entry, True):
2016-05-09T12:47:11.446+0200[STG/0]ERR if metadata.has_metadata('PKG-INFO'):
2016-05-09T12:47:11.447+0200[STG/0]ERR mtime = os.stat(path).st_mtime
2016-05-09T12:47:11.447+0200[STG/0]ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1783, in load
2016-05-09T12:47:11.448+0200[STG/0]ERROSError: [Errno 2] No such file or directory: '/app/.heroku/python/lib/python2.7/site-packages/setuptools-18.3.2-py2.7.egg'
2016-05-09T12:47:11.498+0200[STG/0]OUTStaging failed: Buildpack compilation step failed
2016-05-09T12:47:11.677+0200[API/6]ERRencountered error: App staging failed in the buildpack compile phase

From the errors it seems to me like the error is not in my code, but in something happening in the back on bluemix.

Anyone that can help me figure out what is wrong?

I am using the standard bluemix python-flask boilerplate linked to my github from where I push my code.

EDIT: Answering the comment below, tried that. As soon as I made a change (add my requirements file) it gave the same error.

Requirements file:

Flask==0.10.1
requests
pygal
flask_googlemaps
pandas-highcharts==0.5.2
cloudant==2.0.0b2

Solution

  • It seems like the issue was the

    pandas-highcharts==0.5.2
    

    In the requirements file.

    It appears to be related to the pandas-highcharts installing setuptools-21.0.0 dependency. As a result, setuptools-18.3.2 is uninstalled and removed as denoted in the logs:

    2016-05-09T12:47:10.424+0200[STG/0]OUT Collecting setuptools>=18.5 (from ipython->pandas-highcharts==0.5.2->-r requirements.txt (line 5))

    2016-05-09T12:47:11.027+0200[STG/0]OUT Downloading setuptools-21.0.0-py2.py3-none-any.whl (509kB)
    
    2016-05-09T12:47:11.160+0200[STG/0]OUT Found existing installation: setup tools 18.3.2
    
    2016-05-09T12:47:11.160+0200[STG/0]OUT Installing collected packages: setup tools
    

    2016-05-09T12:47:11.162+0200[STG/0]OUT Uninstalling setuptools-18.3.2:

    2016-05-09T12:47:11.181+0200[STG/0]OUT Successfully uninstalled setuptools-18.3.2

    Later the build complication fails because setuptools-18.3.2 can not be found.

    2016-05-09T12:47:11.448+0200[STG/0]ERROSError: [Errno 2] No such file or directory: '/app/.heroku/python/lib/python2.7/site-packages/setuptools-18.3.2-py2.7.egg'

    2016-05-09T12:47:11.498+0200[STG/0]OUTStaging failed: Buildpack compilation step failed
    2016-05-09T12:47:11.677+0200[API/6]ERRencountered error: App staging failed in the buildpack compile phase
    

    I don't know specifically, after reviewing the related source code on Github, where the issue is caused.

    The solution I went with is just removing it. Instead I used something else for plots

    (in case anyone knows why, we can edit this to include the reason. Might be useful to know for future use).