Keeps getting bash: gunicorn: command not found

I am trying to deploy with Python Flask. My Procfile is web: gunicorn src.app:app, but it keeps telling me “bash: gunicorn: command not found” in the logs. Anyone knows why? I even put gunicorn in my requirements.txt.

Relevent logs:

2022-08-24T20:55:57Z   [info]Starting instance
2022-08-24T20:55:58Z   [info]Configuring virtual machine
2022-08-24T20:55:58Z   [info]Pulling container image
2022-08-24T20:55:58Z   [info]Unpacking image
2022-08-24T20:55:58Z   [info]Preparing kernel init
2022-08-24T20:55:58Z   [info]Configuring firecracker
2022-08-24T20:55:59Z   [info]Starting virtual machine
2022-08-24T20:55:59Z   [info]Starting init (commit: f815f49)...
2022-08-24T20:55:59Z   [info]Preparing to run: `/cnb/process/web` as 1000
2022-08-24T20:55:59Z   [info]2022/08/24 20:55:59 listening on [fdaa:0:86e5:a7b:8a0f:71f1:4d98:2]:22 (DNS: [fdaa::3]:53)
2022-08-24T20:55:59Z   [info]bash: gunicorn: command not found
2022-08-24T20:56:00Z   [info]Starting clean up.

I would suggest you ssh into the image, and see if you can figure out the steps to run gunicorn from there interactively. Then once that works, put those same steps in your Dockerfile. You may have skipped pip install -r requirements.txt in your Dockerfile, or you could be missing a path or something else.

Oh, I am not using Docker, I just followed the official guide for python, but I am looking into dockerfile right now. Is there a way to get gunicorn without docker?

oh sorry, under the hood Fly uses a lot of Docker. You might not be exposed to it for your use case.

I’d still try ssh’ing in and seeing if you can get gunicorn running interactively. That will give you a clue if anything was missing. Like, did it install the requirements.txt ?

Thanks for your help, I ended up learning and switching to DockerFile instead of gunicorn, and now it’s working. I guess using Docker is the most reliable way to deploy to fly

Glad it worked for you! If nothing else, the docker approach has less magic so you can see what’s going on.