1

I have a number of heroku applications that I've been able to update pretty seamlessly until recently. They make use of tensorflow and streamlit, and all give off similar messages on deployment:

-----> Compressing...
remote:  !     Compiled slug size: 560.2M is too large (max is 500M).
remote:  !     See: http://devcenter.heroku.com/articles/slug-size
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 5c0f686a86459f6e81627ce14770f7494f4bd244
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 5c0f686a86459f6e81627ce14770f7494f4bd244
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to dry-caverns-08193.
remote:
To https://git.heroku.com/dry-caverns-08193.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dry-caverns-08193.git'

I know it says the slug size is too large, but they have run previously with the same message, so I'm not sure that's what the issue is.

Here's my file setup:

app.py
Procfile
requirements.txt
setup.sh
my_model/
  -- assets/
  -- variables/
       -- variables.index
       -- variables.data-00000-of-000001
  saved_model.pb

requirements.txt reads as follows:

tensorflow==2.*
streamlit==0.67.0
requests==2.24.0
requests-oauthlib==1.3.0

setup.sh reads as follows:

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

My immediate suspicion is that tensorflow is causing the slug size to be too large -- but again it worked w/ tensorflow previously, so I"m not sure why it would not work now.

Is there anything else it could be?

EDIT:

After looking at this question: Heroku: If you are developing on a branch and deploying via git you must run: I tried git push heroku master:main, but that did not work with the following displaying in the logs:

Push rejected to dry-caverns-08193.
remote:
To https://git.heroku.com/dry-caverns-08193.git
 ! [remote rejected] master -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dry-caverns-08193.git'
Jonathan Bechtel
  • 3,497
  • 4
  • 43
  • 73

2 Answers2

2

If you are using the free dyno:

Make a change in the requirements.txt:

tensorflow-cpu

instead of

tensorflow

This would reduce your slug size considerably

Additionally, your issue may also be dependent on model weight size

Another Tip:

Use a `.slugignore' file if you are directly pulling the code from GitHub so that you can ignore anything like README to GitHub Actions to notebooks from being added to your Dyno

Smaranjit Ghose
  • 230
  • 1
  • 11
0

I haven't thoroughly tested this, but just placing it here in case it helps someone.

I have had many apps over the 500MB slug size limit. It warns but doesn't error when I do this. It is possibly because I am not on the free plan, but on a paid plan. So if someone is desperate to get it working, and cannot reduce the slug size below 500MB any other way, it may be a workable solution to go on the lowest paid plan for that app.

stevec
  • 41,291
  • 27
  • 223
  • 311