# Slug size error in Heroku when deploying Streamlit app

**URL:** <https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821>\
**Category:** Deployment\
**Tags:** heroku\
**Created:** [August 9, 2020, 4:16pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821 "2020-08-09T16:16:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![arun\_ramji](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/arun_ramji/32/2413_2.png) [@arun\_ramji](https://discuss.streamlit.io/u/arun_ramji)\
**Post date:** [August 9, 2020, 4:16pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/1 "2020-08-09T16:16:47Z")

</div>

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\*\*](http://devcenter.heroku.com/articles/slug-size**)  
! Push faile

---

<div class="post-metadata">

**Author:** ![Ian\_Calvert](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ian_calvert/32/1226_2.png) [@Ian\_Calvert](https://discuss.streamlit.io/u/Ian_Calvert)\
**Post date:** [August 10, 2020, 8:06am UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/2 "2020-08-10T08:06:40Z")

</div>

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?

> **[How To Reduce a Large Heroku Slug Size](https://thoughtbot.com/blog/how-to-reduce-a-large-heroku-compiled-slug-size)**
>
> How to fix the “Compiled slug size: 500.6M is too large (max is 500M)” error when trying to deploy your Heroku app.

---

<div class="post-metadata">

**Author:** ![arun\_ramji](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/arun_ramji/32/2413_2.png) [@arun\_ramji](https://discuss.streamlit.io/u/arun_ramji)\
**Post date:** [August 11, 2020, 5:46pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/3 "2020-08-11T17:46:14Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![Ian\_Calvert](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ian_calvert/32/1226_2.png) [@Ian\_Calvert](https://discuss.streamlit.io/u/Ian_Calvert)\
**Post date:** [August 13, 2020, 9:41am UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/4 "2020-08-13T09:41:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ian\_Calvert](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ian_calvert/32/1226_2.png) [@Ian\_Calvert](https://discuss.streamlit.io/u/Ian_Calvert)\
**Post date:** [August 13, 2020, 9:43am UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/5 "2020-08-13T09:43:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arun\_ramji](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/arun_ramji/32/2413_2.png) [@arun\_ramji](https://discuss.streamlit.io/u/arun_ramji)\
**Post date:** [August 13, 2020, 2:19pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/6 "2020-08-13T14:19:46Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Ian\_Calvert](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ian_calvert/32/1226_2.png) [@Ian\_Calvert](https://discuss.streamlit.io/u/Ian_Calvert)\
**Post date:** [August 13, 2020, 2:59pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/7 "2020-08-13T14:59:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arun\_ramji](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/arun_ramji/32/2413_2.png) [@arun\_ramji](https://discuss.streamlit.io/u/arun_ramji)\
**Post date:** [August 13, 2020, 7:25pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/8 "2020-08-13T19:25:57Z")

</div>

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 !!

---

<div class="post-metadata">

**Author:** ![arun\_ramji](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/arun_ramji/32/2413_2.png) [@arun\_ramji](https://discuss.streamlit.io/u/arun_ramji)\
**Post date:** [August 13, 2020, 7:33pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/9 "2020-08-13T19:33:07Z")

</div>

@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 .

> **[How to Deploy a Django Application to Digital Ocean](https://simpleisbetterthancomplex.com/tutorial/2016/10/14/how-to-deploy-to-digital-ocean.html)**
>
> DigitalOcean is a Virtual Private Server (VPS) provider. In my opinion it’s a great service to get started. It’s cheapand very simple to setup. In this tutor...

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 ?

---

<div class="post-metadata">

**Author:** ![Mauro\_Galafassi](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/mauro_galafassi/32/1394_2.png) [@Mauro\_Galafassi](https://discuss.streamlit.io/u/Mauro_Galafassi)\
**Post date:** [August 14, 2020, 5:01pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/10 "2020-08-14T17:01:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arun\_ramji](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/arun_ramji/32/2413_2.png) [@arun\_ramji](https://discuss.streamlit.io/u/arun_ramji)\
**Post date:** [August 16, 2020, 2:19pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/11 "2020-08-16T14:19:43Z")

</div>

@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 !

---

<div class="post-metadata">

**Author:** ![Mauro\_Galafassi](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/mauro_galafassi/32/1394_2.png) [@Mauro\_Galafassi](https://discuss.streamlit.io/u/Mauro_Galafassi)\
**Post date:** [August 17, 2020, 7:13am UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/12 "2020-08-17T07:13:12Z")

</div>

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](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](https://www.youtube.com/watch?v=doCia_CKcko))
3. Add file “captain-definition” to app folder ([https://caprover.com/docs/captain-definition-file.html](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

---

<div class="post-metadata">

**Author:** ![Vibhu\_Gupta](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vibhu_gupta/32/4299_2.png) [@Vibhu\_Gupta](https://discuss.streamlit.io/u/Vibhu_Gupta)\
**Post date:** [December 1, 2020, 3:37pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/13 "2020-12-01T15:37:55Z")

</div>

@arun_ramji were u able some alternative(free service) to Heroku??

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [January 12, 2022, 10:03pm UTC](https://discuss.streamlit.io/t/slug-size-error-in-heroku-when-deploying-streamlit-app/4821/14 "2022-01-12T22:03:23Z")

</div>


