#/bin/bash: line 1: python: command not found

53 messages · Page 1 of 1 (latest)

viscid hawk
#

I'm facing an issue while deploying my Django project on Railway. The deployment logs show the error message "/bin/bash: line 1: python: command not found," even though I have both a requirement.txt file and a runtime.txt file in my project. I'm unsure about the cause of this problem and would appreciate some guidance from a professional developer.

Project id: 50a5c2a5-ff5d-45f0-b4e1-b8e9b312ab96

outer gorgeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

glass plumeBOT
#

Project ID: 50a5c2a5-ff5d-45f0-b4e1-b8e9b312ab96

mint epoch
#

do you happen to have a package.json in your project too?

viscid hawk
#

Yes I do

mint epoch
#

then railway is detecting your project as a node js project and installing node instead of python.

why do you have a package.json?

viscid hawk
#

I am using flowbite and tailwind

#

Whats the work around

mint epoch
#

a modifyed railway.json file

viscid hawk
#

Thanks for your quick replies. Much appreciated

mint epoch
#

I can do this for you, but I'm about to eat dinner, so I'll get back to you later

viscid hawk
#

oh great.

#

Enjoy your dinner. Its morning time here in Australia.

mint epoch
#

am back, please send me your current railway.json file, every deployment has one, even failed deployments, it is located in the details tab of a deployment

viscid hawk
#

ok

#

I do have railway.json file in my repo

mint epoch
#

oh perfect, send that then

viscid hawk
#

{ "$schema": "https://railway.app/railway.schema.json", "build": { "builder": "NIXPACKS" }, "deploy": { "startCommand": "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn webapp.wsgi", "restartPolicyType": "ON_FAILURE", "restartPolicyMaxRetries": 10 } }

mint epoch
#

fwiw you can enclose multi-line code in triple backticks

#

i dont have your code to test with, so this is untested, but let me know how it goes

{
  "$schema": "https://railway.app/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "nixpacksPlan": {
        "providers": ["python"],
        "phases": {
            "setup": {
                "nixPkgs": ["...", "nodejs"]
            }
        }
    },
    "buildCommand": "npm ci"
  },
  "deploy": {
    "startCommand": "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn webapp.wsgi",
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  }
}

viscid hawk
#

you are a legend. thank you heaps . let me test this. Update you soon.

#

It worked

#

thank you so much .

#

very helpful.

mint epoch
#

awsome, glad i could help!

viscid hawk
#

I owe you a coffee

mint epoch
#

haha thanks

viscid hawk
#

so what did you do in the railway.txt

mint epoch
#

overrode the provider back to only python since your main app is python, then added node js as a package, installed the node dependencies with the npm ci build command, and left the start command in tact

#

theres no documentation for this exact use case, ive just used vscode with the schema auto complete

viscid hawk
#

lol

#

thats amazing

#

whats your background? are you a developer?

mint epoch
#

not professionally, just for fun

#

as odd as it may sound, i dont really have a background

viscid hawk
#

oh ok

#

have you worked with django?

mint epoch
#

zero django experience

viscid hawk
#

lol ok

#

whats your strength?

mint epoch
#

helping people with their railway issues

viscid hawk
#

ok cool

#

Thats very kind of you

#

well I know where to come when I need help with railway

mint epoch
#

you sure do!

outer gorgeBOT
#

Thank you for marking this question as solved!

Question Message ID

1113611990238240778

Solution Message ID

1113625020405649419

subtle fractal
#

I'm having this exact same issue for my Django app for which I'm using React as the frontend (so have a package.json). @mint epoch , you mentioned please send me your current railway.json file, every deployment has one, even failed deployments, it is located in the details tab of a deployment

#

I can't seem to find the details tab or the railway.json file. Has it moved by chance?

mint epoch
#

it hasn't moved, but you may be able to use the railway.json file I sent above, just with a slight modification to the start command

subtle fractal
#

Ah thanks! I see, I just add it to my repo. Will try that when I get home later!

#

And will modify the start command accordingly

mint epoch
#

perfect, but if you are still facing issues in the future I ask that you open a new thread as to avoid spamming the OP with notifications

errant granite