ftraian
ftraian

Reputation: 658

Build error on Heroku

I am pushing my Python app to Heroku, it's installing requirements and at the end it crashes. Below is the tail of the log:

....
SWIG/_m2crypto_wrap.c:4237: warning: 'saltlen' may be used uninitialized in this function
gcc -pthread -shared build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -L/usr/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/M2Crypto/__m2crypto.so
Creating /tmp/build_5a922389-3865-4fa2-9bc3-ecfa3cd84781/.heroku/venv/lib/python2.7/site-packages/M2Crypto.egg-link (link to .)
M2Crypto 0.22.dev is already the active version in easy-install.pth

Installed /tmp/build_5a922389-3865-4fa2-9bc3-ecfa3cd84781/.heroku/src/m2crypto
Successfully installed M2Crypto
Cleaning up...
Traceback (most recent call last):
  File "/tmp/buildpack_5a922389-3865-4fa2-9bc3-ecfa3cd84781/vendor/virtualenv-1.7/virtualenv.py", line 16, in <module>
import tempfile
  File "/usr/local/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
  File "/usr/local/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: /tmp/build_5a922389-3865-4fa2-9bc3-ecfa3cd84781/.heroku/venv/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyLong_AsInt
 !     Error making virtualenv relocatable


 !     Push rejected, failed to compile Python app

This is the requrements.txt I am using:

Flask==0.10.1
SQLAlchemy==0.7.8
Flask-Login==0.2.3
Flask-WTF==0.6
Flask-Gravatar
Flask-OAuth==0.12
Flask-SQLAlchemy
Flask-Mail
python-dateutil
alembic
psycopg2
requests
itsdangerous
markdown
raven
blinker
flask-cache
flask-heroku
pygeoip
flask-babel
beautifulsoup4
python-memcached
-e git+https://github.com/Hypernode/M2Crypto#egg=M2Crypto-0.22.dev
birdy

M2Crypto is compiled before the cleanup.

Later Edit:

If I run pip command on the heroku box I get a very simmilar error:

Traceback (most recent call last):
  File "/app/.heroku/venv/bin/pip", line 10, in <module>
load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
  File "/app/.heroku/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
  File "/app/.heroku/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 2279, in load_entry_point
return ep.load()
  File "/app/.heroku/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/app/.heroku/venv/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/__init__.py", line 5, in <module>
    import subprocess
  File "/usr/local/lib/python2.7/subprocess.py", line 427, in <module>
    import select
ImportError: /app/.heroku/venv/lib/python2.7/lib-dynload/select.so: undefined symbol: _PyInt_AsInt

Upvotes: 1

Views: 920

Answers (1)

ftraian
ftraian

Reputation: 658

It turns out Heroku just updated their runtime to python-2.7.7 I had to specify a runtime.txt and to purge the cache of the application(twice) to fix it.

$ cat python-2.7.7>runtime.txt

Then install heroku repo plugin and purge the cache. For Unknown reason the purge_cace did not worked for the first time and had to use twice.

$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a appname

More info about heroku-repo plugin here.

This problem is discussed in this stackoverflow thread or this heroku forum thread.

Upvotes: 2

Related Questions