Issue with serving a streamlit Heroku app in a browser

Hi guys,
I am having problems with serving my app in a browser. I deployed it successfully with Heroku CLI but keep getting the message below on my browser.

Application error

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs –tail

Could anyone help me?
Thanks

@bruno154 well, what does heroku logs -tail give you? heroku logs are usually very helpful and readable.

Hi @maxpumperla thank you for your response.
here it is,
2020-04-18T14:43:53.000000+00:00 app[api]: Build started by user brunovinicius154@gmail.com
2020-04-18T14:45:21.643947+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-18T14:45:21.406811+00:00 app[api]: Deploy a01a64c4 by user brunovinicius154@gmail.com
2020-04-18T14:45:21.406811+00:00 app[api]: Release v5 created by user brunovinicius154@gmail.com
2020-04-18T14:45:34.000000+00:00 app[api]: Build succeeded
2020-04-18T14:45:45.295290+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-18T14:45:45.299142+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-18T14:45:45.222934+00:00 app[web.1]: bash: streamlit: command not found
2020-04-18T14:46:02.460972+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-18T14:46:02.371569+00:00 app[web.1]: bash: streamlit: command not found
2020-04-18T14:46:03.984589+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=wineclassifierapp.herokuapp.com request_id=0be796fb-8704-4299-a5a9-f4e90bd3be89 fwd=“187.65.211.112” dyno= connect= service= status=503 bytes= protocol=https
2020-04-18T14:46:18.159207+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=wineclassifierapp.herokuapp.com request_id=3616016c-7cf2-422b-80d8-f53048ecef9a fwd=“187.65.211.112” dyno= connect= service= status=503 bytes= protocol=https
2020-04-18T14:46:18.355354+00:00 heroku[router]: at=error code=H10 desc=“App crashed”

The problem is that streamlit is not installed on heroku, hence you get bash: streamlit: command not found. this is easy to spot (and pretty much the way you debug all such traces): you find the interesting stuff between the general heroku app logs and the low-level error messages.

My spidey senses tell me that you do not have a requirements.txt with streamlit in it.

Hi @maxpumperla thanks again for your time.
Actually i do have streamlit on my requirements.txt.
streamlit==0.57.3

All the files are here:

Thanks again

scikit-learn has scipy as dependency, which doesn’t work on heroku without extra work. install a build pack for your project like so:

heroku config:set BUILDPACK_URL=https://github.com/andrewychoi/heroku-buildpack-scipy.git

Also, you might just want to slim down your reqs, this is enough:

streamlit
pandas
plotly
scikit-learn

specify the versions if you like.

1 Like

Hi, there’s no error with the scikit-learn @bruno154 @maxpumperla.

I did it with the following guideline here

just take note for the setup.sh you need the following text instead ( append last line )

mkdir -p ~/.streamlit/
echo "\
[general]\n\
email = \"andrewng_@hotmail.com\"\n\
" > ~/.streamlit/credentials.toml
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
" > ~/.streamlit/config.toml

Hi Andrew thank you for your help!
I tried here and issue persists below the logs any help would be very much appreciated.

Thanks in advance

2020-07-15T23:29:28.581628+00:00 heroku[web.1]: State changed from crashed to starting
2020-07-15T23:29:43.779599+00:00 heroku[web.1]: Starting process with command sh setup.sh && streamlit run app.py
2020-07-15T23:29:45.509872+00:00 app[web.1]: bash: streamlit: command not found
2020-07-15T23:29:45.552896+00:00 heroku[web.1]: Process exited with status 127
2020-07-15T23:29:45.595014+00:00 heroku[web.1]: State changed from starting to crashed
2020-07-15T23:40:01.798465+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=wineclassifierapp.herokuapp.com request_id=61692443-9062-4bc6-a647-bb7c555cd90d fwd=“191.191.117.89” dyno= connect= service= status=503 bytes= protocol=https

@bruno154 I suggest that you deploy a ‘Hello World’ before you dive deep on your wine classifier. You can use my files as a reference less Docker

1 Like

@Andrew_Ng, i will check your files but i already have others apps deployed even more complex than this one(code wise at least). I just cant understand what is going wrong here, maybe something related to the pickle that i use to load the model.

Well, thanks for help me.

I think pickle should be fine since it’s based on python if jobslib it’s more sensitive, scikit-learn version need to be similar. versioning window for scikit is smaller than pickle.

I’m having the same issue as @bruno154:

I’ve included Streamlit in my reqs and my setup.sh file is the same as @Andrew_Ng

I am a Junior Data Scientist trying to gain some skills in the Machine Learning Engineering field so Developer and Stack knowledge are that of a beginner so I apologise for any basics I may be overlooking

UPDATE: removing the Pipfile/Pipfile.lock and just leaving the requirements.txt solved my issue.

I’m having problems with the XGBoostRegressor but that’s a different issue :laughing:.

Hope this helps!

I have deployed streamlit app on heroku and also integrated code editor online, have a look at this link:
https://protected-harbor-14829.herokuapp.com/

any update on this error? I got the same error and stuck with it. My requirements.txt has
streamlit==0.57.0
fastai==1.0.61
numpy==1.18.5
pandas==1.0.5

your help would be appreciated. Thanks!

Can you provide the repo, please?
If you are using fastai and deploy it through Heroku, it’s better to use the wheel file path for torch. Otherwise, it’ll exceed the slug size.

Maybe you can change the requirements.txt to:

streamlit
numpy
https://download.pytorch.org/whl/cpu/torch-1.1.0-cp36-cp36m-linux_x86_64.whl
fastai
pandas
1 Like

I came up with the same issue (bash: streamlit: command not found). For me, I solved it after writing a file called runtime.txt in root folder specifying the specific version of Python to install (besides following the requirements.txt to install required versions of packages). I solve the issue by writing the single line of text in the “runtime.txt” file:

python-3.9.4

version. Other python versions might not work.

As heroku said here: Specifying a Python Runtime | Heroku Dev Center
It is likely that 3.9.4 version is preferred by heroku. The problem here might be: whether bash can tell the correct version of python (with required packages) when running shell program.

I am facing the same issue, however, I was able to deploy the site once, after which the error “streamlit not found” was thrown

Hi @Namya_LG, welcome to the Streamlit community! :tada: :partying_face:

Were you able to solve this issue? I see you’ve made a post after this one about another error, presumably from the same application.