Search code examples
pythonheroku

Slug size too large for flask app on Heroku


i am deploying a fairy simple flask app, with a face recognition model. I am only pushing the flask app code and model weights to Heroku. Still my slug size s 556M which exceeds 500M limit. I have minimum requirements in requirements.txt. What could be the issue here? Can the tensorFlow dependency be the cause?

absl-py==0.11.0
astunparse==1.6.3
cachetools==4.2.0
camera==1.3.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
Flask==1.1.2
flatbuffers==1.12
gast==0.3.3
google-auth==1.24.0
google-auth-oauthlib==0.4.2
google-pasta==0.2.0
grpcio==1.32.0
h5py==2.10.0
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
Keras-Preprocessing==1.1.2
Markdown==3.3.3
MarkupSafe==1.1.1
numpy==1.19.5
oauthlib==3.1.0
opencv-python==4.5.1.48
opt-einsum==3.3.0
protobuf==3.14.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7
six==1.15.0
tensorboard==2.4.1
tensorboard-plugin-wit==1.7.0
tensorflow==2.4.0
tensorflow-estimator==2.4.0
termcolor==1.1.0
typing-extensions==3.7.4.3
urllib3==1.26.2
Werkzeug==1.0.1
wrapt==1.12.1

Solution

  • TensorFlow dependency is pretty large and increases significantly the slugsize.

    You have 3 options: