Slug size error in Heroku when deploying Streamlit app

Hi guys. I am not sure if it is a right forum to ask this but still ,
when I try to deploy Streamlit app in to Heroku cloud server , I am getting error as below , not sure how to fix this ,any help would be highly appreciated .

P.S - thanks Streamlit team for making this wonderful library .

tensorboard-2.1.1 tensorflow-2.1.0rc2 tensorflow-estimator-2.1.0 termcolor-1.1.0 terminado-0.8.3 testpath-0.4.4 toml-0.10.1 toolz-0.10.0 tornado-6.0.4 traitlets-4.3.3 tzlocal-2.1 urllib3-1.25.10 validators-0.17.1 watchdog-0.10.3 wcwidth-0.2.5 webencodings-0.5.1 werkzeug-1.0.1 widgetsnbextension-3.5.1 wrapt-1.12.1 zipp-3.1.0
-----> Discovering process types
Procfile declares types -> web
-----> Compressing…
! Compiled slug size: 590.4M is too large (max is 500M).
** ! See: http://devcenter.heroku.com/articles/slug-size**
! Push faile

1 Like

Looks like the total package is too large, a combination of packages, data and code, do you have something like a large model file committed?

2 Likes

@Ian_Calvert only the model file(.h5) has file size around 20MB , do you thinks that’s what causing an issue ?

I also tried first step mentioned in that link , still facing same issue

Potentially the dependencies are too large, but it’s worth checking how big your git repo is (just the folder locally). That 20M file if there’s a few updates in the history could take up a lot if the whole history is in the slug.

Essentially once it’s built your app the total is too large. Any dependencies you don’t need?

Looking at deploying tensorflow apparently that itself is pretty huge. Tensorflow 1 is smaller, or you otherwise may need to find alternative hosting.

1 Like

Thanks @Ian_Calvert , I think the same , in AWS EC2(free tier) also I faced the similar memory issue while Installing TensorFlow .

Can you please suggest any free hosting service like Heroku which provides easy deployment support for steamilt application ?

I’m not sure of a free one, it could be worth looking at other vps/similar options. A $5/mo instance from digital ocean is pretty capable and there are a few different providers like that

1 Like

Thanks @Ian_Calvert , Now I am trying with digital Ocean vps .

Just FYI , there is no clear documentation available online about deploying Streamlit app in DigitalOcean vps . Would be really helpful for beginners like me if your team can add steps to deploy Streamlit app in Digital ocean .

Thanks !!

@Ian_Calvert , I followed the below tutorial about deploying Django application into DigitalOcean , so far I have cloned the GitHub repository in server and installed most of the required dependencies .

wondering if I need to configure Gunicorn and NGINX as mentioned in that document ??

can you please explain what should be the next step to get my app deployed ?

@arun_ramji on Digital Ocean you can try CapRover (1-click in marketplace)
CapRover it’s similar to Heroku.

@Mauro_Galafassi thanks ! can you please post the steps to deploy Streamlit app using CapRover .

@Adrien_Treuille Wouldn’t it be great if Streamlit provides VPS to deploy the Streamlit app exclusively in single click ??

Thanks !

Hi @arun_ramji.
I apologize in advance if I’m not clear in all the steps.

  1. install caprover CLI in your local computer (https://caprover.com/docs/get-started.html step 3)
  2. You prepare your streamlit app to deploy with a docker container (https://www.youtube.com/watch?v=doCia_CKcko)
  3. Add file “captain-definition” to app folder (https://caprover.com/docs/captain-definition-file.html). In my case contents of the file is:
    {
    “schemaVersion”: 2,
    “dockerfilePath”: “./Dockerfile”
    }
  4. On caprover server create a new app
  5. In app folder run “caprover deploy” and follow the instructions
  6. in setting app on caprover server (tab http settings) set parameter:
  • http container port: the same port where run streamlit app.
  • And flag websocket support.

I hope I have been clear enough

3 Likes