Reputation: 21
I followed the exact steps as mentioned in the article, while deploying my django project to heroku.
However, I am getting the following error for git push heroku master
:
Please could anyone let me know what could be the possible issue.
FYI:
I have the Procfile
, requirements.txt
, runtime.txt
in my project root directory. I am also sure my credentials are correct. Also, I havn't pushed anything to master before and I am the only owner of this app.
My runtime.txt
has the code: python: 3.7.9.
My Procfile
has the code: web: gunicorn cardamage.wsgi --log-file -
My requirements.txt:
absl-py==0.12.0
astunparse==1.6.3
cachetools==4.2.1
certifi==2020.12.5
chardet==4.0.0
cycler==0.10.0
dj-database-url==0.5.0
Django==1.10
django-heroku==0.3.1
gast==0.3.3
google-auth==1.28.0
google-auth-oauthlib==0.4.4
google-pasta==0.2.0
grpcio==1.36.1
gunicorn==20.1.0
h5py==2.10.0
idna==2.10
importlib-metadata==3.10.0
joblib==1.0.1
Keras==2.4.0
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
kiwisolver==1.3.1
Markdown==3.3.4
matplotlib==3.4.1
numpy==1.20.2
oauthlib==3.1.0
opt-einsum==3.3.0
pandas==1.1.5
pickle5==0.0.11
Pillow==8.2.0
protobuf==3.15.7
psycopg2==2.8.6
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
PyYAML==5.4.1
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7.2
scikit-learn==0.24.1
scipy==1.4.1
seaborn==0.11.1
six==1.15.0
tensorboard==2.2.2
tensorboard-plugin-wit==1.8.0
tensorflow==2.2.0
tensorflow-estimator==2.2.0
termcolor==1.1.0
threadpoolctl==2.1.0
typing-extensions==3.7.4.3
urllib3==1.26.4
Werkzeug==1.0.1
whitenoise==5.2.0
wrapt==1.12.1
zipp==3.4.1
Upvotes: 2
Views: 1251
Reputation: 2235
The maximum allowed slug size (after compression) is 500 MB in heroku.Your compiled slug-size
is too large because you use Tensorflow
module.
Tensorflow
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.
pip install tensorflow-cpu
Simply replace tensorflow
with tensorflow-cpu
in your requirements.py.
-------------------- OR --------------------
Just replace your TensorFlow
version to 2.0.0 by doing:
tensorflow==2.0.0
It has a much lighter weight file and will fit your memory limit. Also, you can use 1.7.0 or 1.5.0 versions.
Update:
You can try and reduce your slug size in a number of ways. The easiest is to add a .slugignore
file to your application to tell the slug compiler to ignore any unnecessary files in your application, such as static assets.
To determine what files/folders
are taking up space in your slug you can inspect slug by starting up a one-off dyno like so:
heroku run bash -a <appname>
Once in the dyno you can use the du -ha --max-depth 1 /app | sort -hr
command to show the files and folders in the current directory, ordered by size:
Ex.
~ $ du -ha --max-depth 1 /app | sort -hr
108M /app
99M /app/vendor
8.1M /app/.heroku
448K /app/lib
292K /app/spec
8.0K /app/Gemfile.lock
4.0K /app/Procfile
4.0K /app/Gemfile
This can be helpful in determining where large files are.
You may also find that clearing the build cache helps reduce the size of the slug.
In your case you used tensorflow
,scikit-learn
,Keras
,etc.. This all libraries are very large.So AWS is best solution for you.
Upvotes: 1