Last Updated: February 25, 2016
· mike360

Heroku’s Memcache Bootstrapping and custom pip requirements setups in Django

I've been following along Heroku's Scaling a Django Application with Memcache tutorial and ran into a snag. When I tried to push an update to Heroku that would install pylibmc Heroku threw up a lovely error at me:

_pylibmcmodule.c:2140: error: ‘LIBMEMCACHED_VERSION_STRING’ undeclared (first use in this function)

_pylibmcmodule.c:2140: warning: passing argument 3 of ‘PyModule_AddStringConstant’ from incompatible pointer type

/app/.heroku/python/include/python2.7/modsupport.h:42: note: expected ‘const char *’ but argument is of type ‘struct PylibMC_Behavior *’

error: command 'gcc' failed with exit status 1

Command /app/.heroku/python/bin/python -c "import setuptools;__file__='/tmp/pip-build-u54544/pylibmc/';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3BoZ52-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-u54544/pylibmc
       Storing complete log in /app/.pip/pip.log

!     Push rejected, failed to compile Python app

The problem was pretty simple but it’s not documented, as the Heroku tutorial assumes you follow their practice of keeping all requirements in the main requirements.txt file