Black Lives Matter. Please consider donating to Black Girls Code today.

Failed deployment on Heroku

Hi,

I am having a hard time deploying a Dash app on Heroku. I set up my virtual environment as follows:

git init        
virtualenv -p python3 venv # to force the use of python 3 otherwise it uses python 2.7 for some reason
source venv/bin/activate 

then install packages

pip3 install dash
pip3 install dash-renderer
pip3 install dash-core-components
pip3 install dash-html-components
pip3 install plotly
pip3 install gunicorn
pip freeze > requirements.txt

then deploy

git add .
git commit -m 'deployment 1'
git push heroku master

But I get the following error

...
remote:          Downloading https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz
remote:            Complete output from command python setup.py egg_info:
remote:            This backport is for Python 2.7 only.
remote:
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-j0kwb7bi/functools32/
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed

Any ideas why this might be happening?

I’m not familiar with that particular error message, and it’s hard to tell without seeing all your application code, but be sure to reference the Heroku deployment example by @chriddyp if you haven’t done so already.
There’s also great step-by-step walk-through of Heroku deployment for Dash here – see pages 90 and following – Hat tip to Jose Portilla for providing this documentation.
For me, the most common error was omitting the line server = app.server after app = dash.Dash().

Thanks for the reply Austin. I went through the Heroku deployment example by @chriddyp. It used to work, but I get the same error message with that now so I guess there is something more fundamentally wrong with my python setup.

The app works fine locally but only falls over when deployed on Heroku

One other thing, looking at a related post I noticed that my virtual environment was using python 2.7. I forced it to use python 3.6 (virtualenv -p python3 venv) but I still get the same error message. Its strange that I should have to force it to install Python 3.6 though.

I just figured it out. I removed the following from the requirements.txt file:

functools32==3.2.3.post2
pkg-resources==0.0.0

And now it works.