Issue with serving a streamlit Heroku app in a browser

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.

I have been able to resolve this error, had to delete the project, and create a new one.

It would be a great help to provide some reference with regard to uploading PDF’s and performing an OCR. I am facing a lot of issues in accomplishing the same

1 Like

Same problem…

I am having the same problem. Referenced all comments above and still no solution.

2021-06-02T06:09:20.643249+00:00 app[api]: Deploy 0cf2a87a by user isaacshareef@gmail.com

2021-06-02T06:09:20.643249+00:00 app[api]: Release v11 created by user isaacshareef@gmail.com

2021-06-02T06:09:21.375730+00:00 heroku[web.1]: State changed from crashed to starting

2021-06-02T06:09:25.783690+00:00 heroku[web.1]: Starting process with command sh setup.sh && streamlit run rtp.py

2021-06-02T06:09:28.001339+00:00 app[web.1]: bash: streamlit: command not found

2021-06-02T06:09:28.056036+00:00 heroku[web.1]: Process exited with status 127

2021-06-02T06:09:28.129087+00:00 heroku[web.1]: State changed from starting to crashed

2021-06-02T06:09:32.000000+00:00 app[api]: Build succeeded

2021-06-02T06:09:36.455731+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=retrain-prediction-app.herokuapp.com request_id=776716bb-6eb5-47b8-8cc6-4728852b4068 fwd=“73.243.252.126” dyno= connect= service= status=503 bytes= protocol=https

2021-06-02T06:09:36.731107+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=retrain-prediction-app.herokuapp.com request_id=9c15ec3f-6b4f-41c5-97b6-892307aea9d7 fwd=“73.243.252.126” dyno= connect= service= status=503 bytes= protocol=https

I’m getting the same error. Streamlit is in my requirements.txt. Added a runtime.txt to specify python version to no avail.

I managed to fix mine. It was due to needing the GDAL package. I had to have it so my requirements.txt only had the minimal packages (not using pip freeze). Then I had to ensure that the buildpacks were in this order:

1. heroku/python
2. https://github.com/heroku/heroku-geo-buildpack.git