Flask Deployment on Heroku Issue : App not compatible with buildpack

29 Views Asked by At

I hope you can help me out, I developed a flask app and I'm trying to deploy to heroku.

I have researched and followed the steps I came across in youtube videos etc

My git tree is clean, I have a requirements.txt file with all the dependencies present, I have a Procfile (without an extension) sitting in the root folder, but I keep getting this error message upon my attempt to run

git push heroku main

-----> Building on the Heroku-22 stack
-----> Using buildpack: https://github.com/heroku/heroku-buildpack-python.git
-----> App not compatible with buildpack: https://github.com/heroku/heroku-buildpack-python.git
       More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
 !     Push failed

I have tried deleting the app and starting over, no luck, I have read all similar issues but nothing sticks out as the cause of this issue.

I have also tried setting the heroku stack to 20 , then reverting back to 22 when it did not work.

It's been very frustrating, heroku support has not responded to my ticket yet. Can anyone help?

Here's my requirements.txt

    alembic==1.13.1
    amqp==5.2.0
    aniso8601==9.0.1
    annotated-types==0.6.0
    anyio==4.2.0
    argon2-cffi==23.1.0
    argon2-cffi-bindings==21.2.0
    arrow==1.3.0
    asttokens==2.4.1
    async-lru==2.0.4
    attrs==23.2.0
    Babel==2.14.0
    bcrypt==4.1.2
    beautifulsoup4==4.12.2
    billiard==4.2.0
    bleach==6.1.0
    blinker==1.7.0
    bs4==0.0.1
    celery==5.3.6
    certifi==2023.11.17
    cffi==1.16.0
    charset-normalizer==3.3.2
    click==8.1.7
    click-didyoumean==0.3.0
    click-plugins==1.1.1
    click-repl==0.3.0
    colorama==0.4.6
    comm==0.2.1
    cx_Oracle==8.3.0
    debugpy==1.8.0
    decorator==5.1.1
    defusedxml==0.7.1
    dnspython==2.4.2
    email-validator==2.1.0.post1
    et-xmlfile==1.1.0
    executing==2.0.1
    fastapi==0.108.0
    fastjsonschema==2.19.1
    Flask==3.0.0
    Flask-Admin==1.6.1
    Flask-Bcrypt==1.0.1
    Flask-Cors==4.0.0
    Flask-DebugToolbar==0.14.1
    Flask-Login==0.6.3
    Flask-Mail==0.9.1
    Flask-Migrate==4.0.5
    Flask-RESTful==0.3.10
    Flask-SQLAlchemy==3.1.1
    Flask-Uploads==0.2.1
    Flask-WTF==1.2.1
    fqdn==1.5.1
    gitdb==4.0.11
    GitPython==3.1.41
    greenlet==3.0.3
    gunicorn==21.2.0
    html5lib==1.1
    idna==3.6
    iniconfig==2.0.0
    ipykernel==6.28.0
    ipython==8.20.0
    isoduration==20.11.0
    itsdangerous==2.1.2
    jedi==0.19.1
    Jinja2==3.1.2
    json5==0.9.14
    jsonpointer==2.4
    jsonschema==4.20.0
    jsonschema-specifications==2023.12.1
    jupyter-events==0.9.0
    jupyter-lsp==2.2.1
    jupyter-server-mathjax==0.2.6
    jupyter_client==8.6.0
    jupyter_core==5.7.1
    jupyter_server==2.12.4
    jupyter_server_terminals==0.5.1
    jupyterlab==4.0.10
    jupyterlab_git==0.50.0
    jupyterlab_pygments==0.3.0
    jupyterlab_server==2.25.2
    jupytext==1.16.1
    kombu==5.3.4
    lckr_jupyterlab_variableinspector==3.1.0
    lxml==5.1.0
    Mako==1.3.0
    markdown-it-py==3.0.0
    MarkupSafe==2.1.3
    matplotlib-inline==0.1.6
    mdit-py-plugins==0.4.0
    mdurl==0.1.2
    mistune==3.0.2
    multimethod==1.10
    mypy-extensions==1.0.0
    mysql-connector-python==8.3.0
    nbclient==0.9.0
    nbconvert==7.14.1
    nbdime==4.0.1
    nbformat==5.9.2
    nest-asyncio==1.5.8
    notebook==7.0.6
    notebook_shim==0.2.3
    numpy==1.26.3
    openpyxl==3.1.2
    overrides==7.4.0
    packaging==23.2
    pandas==2.1.4
    pandera==0.18.0
    pandocfilters==1.5.0
    parso==0.8.3
    pexpect==4.9.0
    platformdirs==4.1.0
    plotly==5.18.0
    pluggy==1.3.0
    prometheus-client==0.19.0
    prompt-toolkit==3.0.43
    psutil==5.9.7
    psycopg2==2.9.9
    ptyprocess==0.7.0
    pure-eval==0.2.2
    pycparser==2.21
    pydantic==2.5.3
    pydantic_core==2.14.6
    Pygments==2.17.2
    pyodbc==5.0.1
    pytest==7.4.4
    python-dateutil==2.8.2
    python-json-logger==2.0.7
    pytz==2023.3.post1
    pywin32==306
    pywinpty==2.0.12
    PyYAML==6.0.1
    pyzmq==25.1.2
    referencing==0.32.1
    requests==2.31.0
    rfc3339-validator==0.1.4
    rfc3986-validator==0.1.1
    rpds-py==0.17.1
    Send2Trash==1.8.2
    six==1.16.0
    smmap==5.0.1
    sniffio==1.3.0
    soupsieve==2.5
    SQLAlchemy==2.0.25
    stack-data==0.6.3
    starlette==0.32.0.post1
    tenacity==8.2.3
    terminado==0.18.0
    tinycss2==1.2.1
    toml==0.10.2
    tornado==6.4
    traitlets==5.14.1
    typeguard==4.1.5
    types-python-dateutil==2.8.19.20240106
    typing-inspect==0.9.0
    typing_extensions==4.9.0
    tzdata==2023.4
    uri-template==1.3.0
    urllib3==2.1.0
    vine==5.1.0
    wcwidth==0.2.13
    webcolors==1.13
    webencodings==0.5.1
    websocket-client==1.7.0
    Werkzeug==3.0.1
    wrapt==1.16.0
    WTForms==3.1.2
    xeus-python==0.15.12
    xeus-python-shell==0.5.0
    xlwings==0.30.13

I am using python 3.12.1

1

There are 1 best solutions below

0
pyguypy On

So I finally figured out what the issue was. I hope this helps someone else.

First ensure that your flask folder structure is as it would be deployed on heroku, so for example if you are working from a main respository and your flask app is a few levels deep within the repository, this will cause an issue when deploying to heroku. You will need to deploy just the folder with the flask app because there are a lot of dependencies required at root folder level (requirements.txt, Profile) that will prevent sucessful deployment, if not present.

Second, if there are packages that have been upgraded, they may no longer be compatible with the version of python running on heroku, you may need to either downgrade or exlcude entirely from deployment.

Finally , if you are using postgres database, you will need to amend the first part of the database url from postgres to postgresql, not within heroku as this is not possible but using replace string method in your config file.

Hope this help someone.