Streamlit App crashes on Heroku

For the record I been searching all over the Streamlit Forum and Stack Overflow for finding a solution before posting this question.

I developed a PyTorch based Image Classification Inference App (Covid Detector) using Streamlit. I tried to deploy the app in Heroku. But the app crashes on Heroku for an unknown reason. Please help me resolve it.

Here’s my repository : Covid-Detector

requirements.py
streamlit==0.62.0
https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp36-cp36m-linux_x86_64.whl
https://download.pytorch.org/whl/cpu/torchvision-0.6.1%2Bcpu-cp36-cp36m-linux_x86_64.whl
opencv_contrib_python==4.2.0.34
numpy==1.17.2
Pillow==7.1.2

2020-06-23T21:58:25.453800+00:00 heroku[web.1]: State changed from starting to crashed

2020-06-24T03:36:28.910332+00:00 heroku[web.1]: State changed from crashed to starting

2020-06-24T03:36:48.637972+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app.py`  
                                                                                          
2020-06-24T03:36:53.063897+00:00 heroku[web.1]: Process exited with status 139

2020-06-24T03:36:53.099917+00:00 heroku[web.1]: State changed from starting to crashed

2020-06-24T04:59:03.034010+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=corona-xray-detector.herokuapp.com request_id=41d80cd4-e50d-46e8-95b1-820c76284a3c fwd="157.50.221.252" dyno= connect= service= status=503 bytes=protocol=https

2020-06-24T04:59:04.307493+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=corona-xray-detector.herokuapp.com request_id=15175180-2d40-4f52-b97e-59c604b99228 fwd="157.50.221.252" dyno= connect= service= status=503 bytes= protocol=https
1 Like

Having the same issue. I did make sure my Procfile and setup.sh is correct

2 Likes

I am getting the same issue. I am too using PyTorch and Opencv to deploy over heroku Repo. It is giving same H10 error. It works fine locally. I have checked it. Please provide solution.

2 Likes

Haven’t check it for a while and use AWS instead to deploy it on the web using this tutorial https://mlwhiz.com/blog/2020/02/22/streamlitec2/

1 Like

While it might feel like an unsatisfactory response, plenty of people seem to be able to deploy on Heroku, so it’s definitely possible. Your Procfile and setup.sh can’t be right and not work.

I would suggest doing the most basic example you can first, where there are no imports other than Streamlit and your configuration file. Once you can make that work, then you can layer in the complexity.

Hi. Have you found the solution for this? I faced a similar issue recently because I had to download easyocr library which runs on PyTorch.

Same issue with my project.
Works excellent at localhost but while deploying it using heroku CLI, it gives me this warning.

the config option ‘server.enableCORS=false’ is not compatible with ‘server.enableXsrfProtection=true’. As a result, ‘server.enableCORS’ is being overridden to ‘true’.


I solved the same Error…

If you are using OpenCV-python in reqiurements.py…change it to opencv-contrib-python-headless… It worked for me…

1 Like

That’s right! I solved the same error too! Thank you!