Reputation: 107232
I'm trying to deploy a python web application on Heroku using the following Procfile command:
web: gunicorn service:app --log-file=- --workers 1 --threads 4
This generates the following error:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 139, in load_class
mod = import_module('.'.join(components))
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/gthread.py", line 37, in <module>
""")
RuntimeError:
You need 'concurrent' installed to use this worker with this python version.
As we do not control the gunicorn installation on Heroku, how do I resolve this dependency issue?
Oddly, Heroku do not mention gunicorn threads in their docs, only workers. Is this related?
Upvotes: 5
Views: 2324
Reputation: 5164
Add these lines to your requirements.txt:
futures==2.1.6
trollius==1.0.1
After pushing these changes to your heroku instance you will be able to run gunicorn with threads.
concurrent is a python 3.2 package and is backported to python 2.7 as future package. You should either use at least python 3.2 as your runtime or you should add the backported packages to your project requirements.
Upvotes: 9