Deploy python app to Heroku "Slug Size too large"

just use tensorflow version 1.14 as it is almost half the size of tf2.0+ and servers most purposes.
In my case the slug size almost halved from tf1.14(580MB) at place of tf.2.1(280MB)


I have already answered this here.

Turns out the Tensorflow 2.0 module is very large (more than 500MB, the limit for Heroku) because of its GPU support. Since Heroku doesn't support GPU, it doesn't make sense to install the module with GPU support.

Solution:

Simply replace tensorflow with tensorflow-cpu in your requirements.

This worked for me, hope it works for you too!


In requirements.txt file, I replaced tensorflow==2.6.0 to tensorflow-cpu==2.6.0 and it worked perfectly


Just replace your TensorFlow version to 2.0.0 by doing:
tensorflow==2.0.0
It has a much lighter whl file and will fit your memory limit. Also, you can use 1.7.0 or 1.5.0 versions.