gunicorn command not found, but gunicorn is installed successfully

fanahova
HOBBY

10 months ago

I'm trying to deploy a simple Flask app with gunicorn as a backend. It all worked fine a few days ago, but now I can't seem to get it work. The server fails to start with gunicorn: command not found. Guessing it's some sort of path error; when I do railway shell I get the same error, but if I run pip install gunicorn from the shell, it then works.

This is the railway.json:

{
    "$schema": "https://railway.app/railway.schema.json",
    "build": {
      "builder": "NIXPACKS"
    },
    "deploy": {
      "runtime": "V2",
      "numReplicas": 1,
      "startCommand": "gunicorn web:app",
      "sleepApplication": false,
      "restartPolicyType": "ON_FAILURE",
      "restartPolicyMaxRetries": 10
    }
  }

This is the build log that shows gunicorn was installed successfully:

#10 32.71 Successfully installed Flask-3.0.3 Jinja2-3.1.4 Levenshtein-0.26.0 MarkupSafe-3.0.1 Requests-2.32.3 Werkzeug-3.0.4 aiohappyeyeballs-2.4.3 aiohttp-3.10.10 aiosignal-1.3.1 amqp-5.2.0 annotated-types-0.7.0 anthropic-0.36.0 anyio-4.6.0 attrs-24.2.0 billiard-4.2.1 blinker-1.8.2 celery-5.4.0 certifi-2024.8.30 charset-normalizer-3.4.0 click-8.1.7 click-didyoumean-0.3.1 click-plugins-1.1.1 click-repl-0.3.0 deprecation-2.1.0 distro-1.9.0 filelock-3.16.1 frozenlist-1.4.1 fsspec-2024.9.0 gotrue-2.9.2 gunicorn-23.0.0 h11-0.14.0 h2-4.1.0 hpack-4.0.0 httpcore-1.0.6 httpx-0.27.2 huggingface-hub-0.25.2 hyperframe-6.0.1 idna-3.10 itsdangerous-2.2.0 jiter-0.6.1 kombu-5.4.2 multidict-6.1.0 openai-1.51.2 packaging-24.1 postgrest-0.17.1 prompt-toolkit-3.0.48 propcache-0.2.0 pydantic-2.9.2 pydantic-core-2.23.4 python-dotenv-1.0.1 python_Levenshtein-0.26.0 python_dateutil-2.8.2 pyyaml-6.0.2 rapidfuzz-3.10.0 realtime-2.0.5 redis-5.1.1 replicate-0.15.4 six-1.16.0 sniffio-1.3.1 storage3-0.8.1 strenum-0.4.15 supabase-2.9.0 supafunc-0.6.1 tokenizers-0.20.1 tqdm-4.66.5 typing-extensions-4.12.2 tzdata-2024.2 urllib3-2.2.3 vine-5.1.0 wcwidth-0.2.13 websockets-13.1 yarl-1.14.0

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

2 Replies

fanahova
HOBBY

10 months ago

Just as follow up, deleting the service and re-deploying fixes it, so guessing it was some cache issues? I had tried the NO_CACHE=1 var but it didn't make a difference. Very bizarre.


10 months ago

Please know that railway shell opens a local shell.