I did a search and didn’t seem to find anything (apologies if I missed another thread).
Has anyone had any success in trying to deploy a Plotly Dash App using render? Dash is based on flask so presumably some combination of files and settings would work, but the back end working is beyond me at the moment.
I’m coming across from Heroku which where one just requires the requirements.txt file and a file called Procfile in the root of the project which contains:
web: gunicorn app:server
Linking my Git repo for a project that is working on Heroku doesn’t seem to yield the same result on render.
Any help appreciated,
Thanks for reaching out.
Are you seeing any errors in the logs? Or if the app isn’t starting at all and your deploys are failing, are there any errors in the deploy logs?
Actually yes! It is failing in the deployment stage and according to the logs it looks like it is a version issue from the requirements.txt, here are the last few lines
Feb 21 05:33:09 PM ERROR: No matching distribution found for pandas==1.4.1 (from -r requirements.txt (line 15))
Feb 21 05:33:09 PM WARNING: You are using pip version 20.1.1; however, version 22.0.3 is available.
Feb 21 05:33:09 PM You should consider upgrading via the '/opt/render/project/src/.venv/bin/python -m pip install --upgrade pip' command.
Feb 21 05:33:09 PM ==> Build failed 😞
Feb 21 05:33:09 PM ==> Generating container image from build. This may take a few minutes...
This is newer than this morning because it first failed on my Numpy install so I downgraded that, then in this case it failed on my Pandas install; presumably because Plotly is contingent on Pandas if I downgraded Pandas next Plotly would fail
Further up in the logs it does say
Feb 21 05:33:00 PM ==> Using **Python version: 3.7.10**
Feb 21 05:33:03 PM ==> Running build command 'pip install -r requirements.txt'...
I hadn’t realised Python versions aren’t in the requirements file, the base Python on my machine which was used to freeze requirements is 3.8 or 3.9; is it possible it is the Python version causing the problems? Is it possible to build off a higher Python version if that is that case?
Thanks for the assistance! It is much appreciated.
Thanks for the added detail. I’m not a Python expert, but what you’ve shared is certainly pointing toward a versioning issue.
pandas 1.4.1 shows as requiring Python >= 3.8
You also mention
numpy which seems to have the same 3.8+ requirement for the latest version.
It’s probably worth trying to keep Python version parity between your development & production/Render environments. You can do this on Render by setting a
PYTHON_VERSION environment variable, mentioned in the docs here: Specifying a Python Version
Hope that helps
Thanks Alan, with that prompt I’ve managed to deploy
For anybody else struggling to deploy a Dash App:
- As noted in Alan’s post the Python version used by render is, by default, not the latest (and not up to date with conda). If you go to the “Environment” tab then you can change the Environment Variables manually, just set the key to PYTHON_VERSION and set Value whatever you like i.e. 3.8.5
- Deploying dash on Heroku requires a Procfile with one line “web: gunicorn app:server” which doesn’t seem to be required by render, however:
- Gunicorn settings are in the “Settings” tab and for Dash, for me, the setting below worked:
NB/ This is different to the render docs for Flask which suggest
Hope that helps others
Glad to hear you were able to get your project deployed and thanks for sharing your findings with the community.