I'm deploying a Python (flask) app to Heroku via the commandline, and after specifying Python 3.8.0 in the runtime I got an error relating to '_ast27' extension I'm not sure what to do with.

If I build the app using Python 3.6.9, it works fine, no errors.

When I add a runtime.txt file specifying python-3.8.0, I get an error during the build and the build fails (error: command 'gcc' failed with exit status 1).

Removing the runtime.txtfile and building with Python 3.6.9 resolves the issue, but I'd prefer to use 3.8.0 because of the security update.

Here are the two parts of the log that look relevant:

building '_ast27' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/ast27
creating build/temp.linux-x86_64-3.8/ast27/Parser
creating build/temp.linux-x86_64-3.8/ast27/Python
creating build/temp.linux-x86_64-3.8/ast27/Custom
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iast27/Include -I/app/.heroku/python/include/python3.8 -c ast27/Parser/acceler.c -o build/temp.linux-x86_64-3.8/ast27/Parser/acceler.o
           ast27/Parser/acceler.c:13:10: fatal error: pgenheaders.h: No such file or directory
#include "pgenheaders.h"
compilation terminated.
error: command 'gcc' failed with exit status 1


Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-i8bnpa9v/typed-ast/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-aq2n5sd0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-i8bnpa9v/typed-ast/
 !     Push rejected, failed to compile Python app.

I'll admit to not understanding what typed-ast is, or what it's for. The googling I've done so far hasn't turned up anything specific relating to pythom 3.8.0 so I'd appreciate any suggestions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.