'bash: gunicorn: app:app not found' but gunicorn was installed?

I have an issue deploying a Python Flask app, following the Render Instructions. For context:

  • I have set gunicorn==20.1.0 in requirements.txt and my app is developed on python 3.7.10
  • Main file: app.py
  • The variable app is used for an instance of Flask and it is called app: app = Flask(__name__)py in app.py
  • Therefore I am (edit: grammar) using the following startup command: gunicorn app:appsh
  • I have tried other deployment methods such as gunicorn 'app:create_app()'sh that follows the “application factory” pattern specified in the documentation but it doesn’t work and I have double-checked that I have correctly reverted it.
  • Sorry for the long post, I couldn’t find a togglable spoiler

The cl also states that it has “Successfully installed… gunicorn-20.1.0” as shown in the attached image:

  • it is wrapped from the second to third line
    • below “Flask-WTF-1.1.1”
    • above “.0 typing-extensions-4.5.0 …”
    • before “importlib-…” on the same line at the beginning.

Here is the full build log:
May 11 12:17:25 AM ==> Using Python version: 3.7.10
May 11 12:17:29 AM ==> Running build command ‘pip install -r requirements.txt’…
May 11 12:17:30 AM Collecting gunicorn==20.1.0
May 11 12:17:30 AM Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
May 11 12:17:31 AM Collecting bcrypt==3.1.4
May 11 12:17:31 AM Downloading bcrypt-3.1.4-cp34-abi3-manylinux1_x86_64.whl (51 kB)
May 11 12:17:31 AM Collecting cffi==1.14.2
May 11 12:17:31 AM Downloading cffi-1.14.2-cp37-cp37m-manylinux1_x86_64.whl (401 kB)
May 11 12:17:31 AM Collecting Click==7.0
May 11 12:17:31 AM Downloading Click-7.0-py2.py3-none-any.whl (81 kB)
May 11 12:17:31 AM Collecting Flask==1.0.2
May 11 12:17:31 AM Downloading Flask-1.0.2-py2.py3-none-any.whl (91 kB)
May 11 12:17:32 AM Collecting Flask-Bcrypt==0.7.1
May 11 12:17:32 AM Downloading Flask-Bcrypt-0.7.1.tar.gz (5.1 kB)
May 11 12:17:32 AM Collecting Flask-DebugToolbar==0.13.1
May 11 12:17:32 AM Downloading Flask_DebugToolbar-0.13.1-py3-none-any.whl (324 kB)
May 11 12:17:32 AM Collecting Flask-SQLAlchemy==2.3.2
May 11 12:17:32 AM Downloading Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl (16 kB)
May 11 12:17:32 AM Collecting Flask-WTF
May 11 12:17:32 AM Downloading Flask_WTF-1.1.1-py3-none-any.whl (12 kB)
May 11 12:17:32 AM Collecting itsdangerous==0.24
May 11 12:17:32 AM Downloading itsdangerous-0.24.tar.gz (46 kB)
May 11 12:17:33 AM Collecting jedi==0.13.1
May 11 12:17:33 AM Downloading jedi-0.13.1-py2.py3-none-any.whl (177 kB)
May 11 12:17:33 AM Collecting Jinja2==2.10
May 11 12:17:33 AM Downloading Jinja2-2.10-py2.py3-none-any.whl (126 kB)
May 11 12:17:33 AM Collecting MarkupSafe==1.1.1
May 11 12:17:33 AM Downloading MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl (33 kB)
May 11 12:17:34 AM Collecting psycopg2-binary
May 11 12:17:34 AM Downloading psycopg2_binary-2.9.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
May 11 12:17:34 AM Collecting six==1.11.0
May 11 12:17:34 AM Downloading six-1.11.0-py2.py3-none-any.whl (10 kB)
May 11 12:17:34 AM Collecting Werkzeug==0.14.1
May 11 12:17:34 AM Downloading Werkzeug-0.14.1-py2.py3-none-any.whl (322 kB)
May 11 12:17:34 AM Collecting WTForms==2.2.1
May 11 12:17:34 AM Downloading WTForms-2.2.1-py2.py3-none-any.whl (166 kB)
May 11 12:17:35 AM Collecting setuptools==39.1.0
May 11 12:17:35 AM Downloading setuptools-39.1.0-py2.py3-none-any.whl (566 kB)
May 11 12:17:35 AM Collecting pycparser
May 11 12:17:35 AM Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
May 11 12:17:35 AM Collecting Blinker
May 11 12:17:35 AM Downloading blinker-1.6.2-py3-none-any.whl (13 kB)
May 11 12:17:37 AM Collecting SQLAlchemy>=0.8.0
May 11 12:17:37 AM Downloading SQLAlchemy-2.0.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB)
May 11 12:17:37 AM Collecting parso>=0.3.0
May 11 12:17:37 AM Downloading parso-0.8.3-py2.py3-none-any.whl (100 kB)
May 11 12:17:37 AM Collecting typing-extensions>=4.2.0
May 11 12:17:37 AM Downloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)
May 11 12:17:38 AM Collecting greenlet!=0.4.17; platform_machine == “aarch64” or (platform_machine == “ppc64le” or (platform_machine == “x86_64” or (platform_machine == “amd64” or (platform_machine == “AMD64” or (platform_machine == “win32” or platform_machine == “WIN32”)))))
May 11 12:17:38 AM Downloading greenlet-2.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (566 kB)
May 11 12:17:38 AM Collecting importlib-metadata; python_version < “3.8”
May 11 12:17:38 AM Downloading importlib_metadata-6.6.0-py3-none-any.whl (22 kB)
May 11 12:17:38 AM Collecting zipp>=0.5
May 11 12:17:38 AM Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB)
May 11 12:17:38 AM Using legacy setup.py install for Flask-Bcrypt, since package ‘wheel’ is not installed.
May 11 12:17:38 AM Using legacy setup.py install for itsdangerous, since package ‘wheel’ is not installed.
May 11 12:17:39 AM Installing collected packages: setuptools, gunicorn, six, pycparser, cffi, bcrypt, Click, itsdangerous, MarkupSafe, Jinja2, Werkzeug, Flask, Flask-Bcrypt, Blinker, Flask-DebugToolbar, typing-extensions, greenlet, zipp, importlib-metadata, SQLAlchemy, Flask-SQLAlchemy, WTForms, Flask-WTF, parso, jedi, psycopg2-binary
May 11 12:17:39 AM Attempting uninstall: setuptools
May 11 12:17:39 AM Found existing installation: setuptools 47.1.0
May 11 12:17:39 AM Uninstalling setuptools-47.1.0:
May 11 12:17:39 AM Successfully uninstalled setuptools-47.1.0
May 11 12:17:40 AM Running setup.py install for itsdangerous: started
May 11 12:17:40 AM Running setup.py install for itsdangerous: finished with status ‘done’
May 11 12:17:40 AM Running setup.py install for Flask-Bcrypt: started
May 11 12:17:41 AM Running setup.py install for Flask-Bcrypt: finished with status ‘done’
May 11 12:17:43 AM Successfully installed Blinker-1.6.2 Click-7.0 Flask-1.0.2 Flask-Bcrypt-0.7.1 Flask-DebugToolbar-0.13.1 Flask-SQLAlchemy-2.3.2 Flask-WTF-1.1.1 Jinja2-2.10 MarkupSafe-1.1.1 SQLAlchemy-2.0.13 WTForms-2.2.1 Werkzeug-0.14.1 bcrypt-3.1.4 cffi-1.14.2 greenlet-2.0.2 gunicorn-20.1.0 importlib-metadata-6.6.0 itsdangerous-0.24 jedi-0.13.1 parso-0.8.3 psycopg2-binary-2.9.6 pycparser-2.21 setuptools-39.1.0 six-1.11.0 typing-extensions-4.5.0 zipp-3.15.0
May 11 12:17:43 AM WARNING: You are using pip version 20.1.1; however, version 23.1.2 is available.
May 11 12:17:43 AM You should consider upgrading via the ‘/opt/render/project/src/.venv/bin/python -m pip install --upgrade pip’ command.
May 11 12:17:45 AM ==> Uploading build…
May 11 12:17:53 AM ==> Build uploaded in 8s
May 11 12:17:53 AM ==> Build successful :tada:
May 11 12:17:53 AM ==> Deploying…
May 11 12:18:30 AM ==> Starting service with ‘gunicorn app:app’
May 11 12:18:30 AM bash: gunicorn app:app: command not found

Thanks!

I’m having the same issue! I hope someone replies with a solution!

Hi there,

I can’t see anything obviously wrong here. Can you check what happens if you run which gunicorn from your services shell? You should see something like:

$ which gunicorn/opt/render/project/src/.venv/bin/gunicorn

We may need you to open a ticket with us so we can check your service environment.

Thanks,
Keith

bash: gunicorn app:app: command not found

Re-type your Start Command character by character.

Anyone having this error needs to clear their Start Command and re-type it all character by character. I recommend Ctrl+a (Command+a if you’re on macOS), backspace, re-type. The important part of this is that it says gunicorn app:app is not found. This isn’t a problem of Gunicorn not being installed, it is treating the entire string as a command, rather than a command (gunicorn) and its argument (app:app). There is a non-space character in there, either a newline or a non-breaking space, or some other special Unicode character that is rendered blank, but is not a hex value 20 space.

It’s the difference between p ᵖ p 𝗉 and 𝚙 except worse because the output is blank so you can’t see any difference. But because it’s not a “plain” space, it’s being treated as a continuation of the command name.

Here’s an example of a system without Gunicorn installed:

bash-5.2$ gunicorn app:app
bash: gunicorn: command not found

Note how the parameter (app:app) isn’t in the error message. That’s because the parameter isn’t the command name, and the command name alone is what doesn’t exist.

Re-type your Start Command.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.