Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Python/Django applications all simultaneously developed ImportError

Today all my Python/Django applications on Heroku stopped working.

The logs for all of them show the same issue. When trying to restart/build, the error log is as shown below.

I have tried rebuilding the projects in a new local virtual environment, and they work fine locally. However, when pushing them to Heroku, they encounter this ImportError and refuse to deploy.

Similarly, when I try to restart the existing applications, I see the same error logged prior to the instance crashing.

Please let me know if there is any other information I can provide.

Error log:

2014-06-03T22:30:05.293788+00:00 heroku[web.1]: State changed from crashed to starting
2014-06-03T22:30:11.509350+00:00 app[web.1]: Traceback (most recent call last):
2014-06-03T22:30:11.509438+00:00 app[web.1]:   File "bluewaterads/manage.py", line 22, in <module>
2014-06-03T22:30:11.509536+00:00 app[web.1]:     from django.core.management import execute_manager
2014-06-03T22:30:11.509589+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 8, in <module>
2014-06-03T22:30:11.509644+00:00 app[web.1]:     from django.core.management.base import BaseCommand, CommandError, handle_default_options
2014-06-03T22:30:11.509667+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 16, in <module>
2014-06-03T22:30:11.509707+00:00 app[web.1]:     from django.utils.encoding import smart_str
2014-06-03T22:30:11.509727+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/encoding.py", line 2, in <module>
2014-06-03T22:30:11.509796+00:00 app[web.1]:     import urllib
2014-06-03T22:30:11.509824+00:00 app[web.1]:   File "/usr/local/lib/python2.7/urllib.py", line 26, in <module>
2014-06-03T22:30:11.509869+00:00 app[web.1]:     import socket
2014-06-03T22:30:11.509886+00:00 app[web.1]:   File "/usr/local/lib/python2.7/socket.py", line 47, in <module>
2014-06-03T22:30:11.509919+00:00 app[web.1]:     import _socket
2014-06-03T22:30:11.509954+00:00 app[web.1]: ImportError: /app/.heroku/venv/lib/python2.7/lib-dynload/_socket.so: undefined symbol: _PyInt_AsInt
2014-06-03T22:30:13.014774+00:00 heroku[web.1]: State changed from starting to crashed
2014-06-03T22:30:10.241602+00:00 heroku[web.1]: Starting process with command `python bluewaterads/manage.py run_gunicorn 0.0.0.0:33709 -w 4`
2014-06-03T22:30:13.015823+00:00 heroku[web.1]: Process exited with status 1

Requirements.txt:

Django==1.4.1
Mezzanine==1.2.4.1
Pillow==1.7.7
South==0.7.6
bleach==1.1.5
boto==2.5.2
dj-database-url==0.2.1
django-appconf==0.5
django-compressor==1.2
django-s3-storages-utils==0.1.0
django-storages==1.1.5
filebrowser-safe==0.2.11
grappelli-safe==0.2.9
gunicorn==0.14.6
html5lib==0.95
psycopg2==2.4.5
pytz==2012d

Procfile:

web: python bluewaterads/manage.py run_gunicorn 0.0.0.0:$PORT -w 4
like image 238
user3704965 Avatar asked Jun 03 '14 23:06

user3704965


1 Answers

When deploying your application, if at runtime the updated python-2.7.7 is not being used.

Try purging the repo cache.

Install this: heroku plugins:install https://github.com/heroku/heroku-repo.git

Then run this command: heroku repo:purge_cache -a appname

Then deploy your application.

More info here: Heroku-repo

like image 111
davierc Avatar answered Oct 13 '22 08:10

davierc