简体   繁体   中英

ERR IOError: [Errno 21] Is a directory: '/app/.heroku/python/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg'

I try to deploy a Flask app in python (python 2.7.10). It is a very easy app with requirements.txt

  • Flask==0.10.1
  • distribute==0.6.27
  • setuptools==20.3
  • scipy==0.17
  • matplotlib==1.5.1
  • pickleshare==0.7.2
  • scikit-learn==0.17.1
  • numpy==1.11.1

The app worked locally. I now try to deploy it on IBM Bluemix and after pasting the command

sudo cf push app
sudo cf logs predict_population --recent

I have this error:

ERR Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bPyipf/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RwvTnr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-bPyipf/distribute/ 2016-09-11T14:09:39.93+0300
[STG/0]      ERR Traceback (most recent call last): 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/bin/pip", line 9, in <module> 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     load_entry_point('pip==8.1.1', 'console_scripts', 'pip')() 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/__init__.py", line 217, in main 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     return command.main(cmd_args) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 246, in main 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     pip_version_check(session) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/outdated.py", line 102, in pip_version_check 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     installed_version = get_installed_version("pip") 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/__init__.py", line 848, in get_installed_version 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     working_set = pkg_resources.WorkingSet() 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 626, in __init__ 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     self.add_entry(entry) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 682, in add_entry 2016-09-11T14:09:39.93+0300
[STG/0]      ERR    for dist in find_distributions(entry, True): 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2080, in find_eggs_in_zip 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     if metadata.has_metadata('PKG-INFO'): 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1610, in has_metadata 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     return self.egg_info and self._has(self._fn(self.egg_info, name)) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1968, in _has 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     return zip_path in self.zipinfo or zip_path in self._index() 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1848, in zipinfo 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     return self._zip_manifests.load(self.loader.archive) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1791, in load 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     manifest = self.build(path) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1764, in build 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     with ContextualZipFile(path) as zfile: 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1813, in __new__ 2016-09-11T14:09:39.93+0300
[STG/0]      ERR     return zipfile.ZipFile(*args, **kwargs) 2016-09-11T14:09:39.93+0300
[STG/0]      ERR   File "/app/.heroku/python/lib/python2.7/zipfile.py", line 756, in __init__ 2016-09-11T14:09:39.94+0300
[STG/0]      ERR     self.fp = open(file, modeDict[mode]) 2016-09-11T14:09:39.94+0300
[STG/0]      ERR IOError: [Errno 21] Is a directory: '/app/.heroku/python/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg'

Solved ! Instead of writing if name == "main": app.run() Just do port = os.getenv('PORT', PORT_NUMBER) if name == "main": app.run(host='0.0.0.0', port=int(port)) and it works !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM