Streamlit Cloud Can't install python module "statsmodel"

Hello!

My streamlit works perfectly in a local environment (google colab, using ngrok to port). When I try to deploy my project to the cloud, it’s not able to download python module “statsmodel”. Is this a known issue or is it just me?

Attached is my log:

Summary

[client] Provisioning machine…
[client] Preparing system…
[client] Spinning up manager process…
e[32m[manager] e[0mStarting up repository: ‘streamlithosting’, branch: ‘main’, main module: ‘streamlit_app.py’
e[32m[manager] e[0mCloning repository…
e[32m[manager] e[0mCloning into ‘/app/streamlithosting’…

e[32m[manager] e[0mCloned repository!
e[32m[manager] e[0mPulling code changes from Github…
e[32m[manager] e[0mProcessing dependencies…
Collecting yfinance
Downloading yfinance-0.1.70-py2.py3-none-any.whl (26 kB)
Collecting streamlit==1.5.0
Downloading streamlit-1.5.0-py2.py3-none-any.whl (9.7 MB)
Collecting matplotlib
Downloading matplotlib-3.5.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.2 MB)
Collecting pandas-datareader
Downloading pandas_datareader-0.10.0-py3-none-any.whl (109 kB)
Collecting plotly-express
Downloading plotly_express-0.4.1-py2.py3-none-any.whl (2.9 kB)
Collecting keras
Downloading keras-2.8.0-py2.py3-none-any.whl (1.4 MB)
Collecting praw
Downloading praw-7.5.0-py3-none-any.whl (176 kB)
Collecting requests
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting vaderSentiment
Downloading vaderSentiment-3.3.2-py2.py3-none-any.whl (125 kB)
Collecting langdetect
Downloading langdetect-1.0.9.tar.gz (981 kB)
Collecting emoji
Downloading emoji-1.6.3.tar.gz (174 kB)
Collecting statistics==1.0.3.5
Downloading statistics-1.0.3.5.tar.gz (8.3 kB)
Collecting bs4
Downloading bs4-0.0.1.tar.gz (1.1 kB)
Collecting tensorflow
Downloading tensorflow-2.8.0-cp37-cp37m-manylinux2010_x86_64.whl (497.5 MB)
Collecting sklearn
Downloading sklearn-0.0.tar.gz (1.1 kB)
Collecting statsmodels==0.13.2
Downloading statsmodels-0.13.2.tar.gz (17.9 MB)
Installing build dependencies: started
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…
Installing build dependencies: still running…

P.S. The same file I try to run now was working 2 days ago.

Thank you!

I had the same issue. My app was running fine until it had gone in sleep and after rebooting the app it started giving me an error like a module not found. I solved this issue by updating streamlit==1.5.0.

Hey @holy

I might be wrong but one of the reasons I believe it isn’t working is due to the massive size of TensorFlow. With every new release, its size is getting bigger and on the free tier, we have 1 GB of space available. From the logs, we can infer that all the libraries were downloaded successfully but the issue occurred while installing them. So maybe your app ran out of maximum available storage and wasn’t able to install all the libraries.
One quick fix is that in your requirements.txt file, replace tensorflow with tensorflow-cpu. This would reduce the size of TensorFlow from 500 MB to around 200 MB and would be a huge boost while making predictions as well because it wouldn’t try to load GPU libraries and we don’t even need them and GPU is not available on the cloud.

Hope this helps
Kanak

1 Like

Hey Kanak,

Thank you so much for your input, I updated my requirements file to TensorFlow-CPU from TensorFlow, checked my app, and saw it up and running!

Thanks again!

1 Like