🚨 Deployment Crashing Due to requests Not Installing – Nixpacks + requirements.txt Ignored?
chidopro
HOBBYOP

10 months ago

Hi Railway Team,

I've been trying to deploy a simple Flask app on Railway using Nixpacks, and I’ve hit a frustrating wall. My app keeps crashing on startup with the following error:

vbnet

CopyEdit

ModuleNotFoundError: No module named 'requests'

Here’s what I’ve set up:

white_check_mark emoji Project Structure

  • requirements.txt includes:

    nginx

    CopyEdit

    flask requests stripe python-dotenv colorama

  • start.sh:

    bash

    CopyEdit

    #!/bin/bash pip install -r requirements.txt python app.py

  • .nixpacks.toml:

    toml

    CopyEdit

    [phases.setup] nixPkgs = ["python311", "gcc"] [phases.install] cmds = [ "python3.11 -m venv venv", ". venv/bin/activate", "pip install -r requirements.txt" ] [phases.start] cmd = ". venv/bin/activate && python app.py"

  • Procfile:

    makefile

    CopyEdit

    web: python app.py

  • The Railway service is set to use the Nixpacks builder and Python is selected in the Providers.

x emoji The Problem

Despite everything being correctly defined, Railway crashes on every deploy with the same error:
ModuleNotFoundError: No module named 'requests'
This suggests the pip install -r requirements.txt step is being skipped or not properly executed, even though it’s in both start.sh and .nixpacks.toml.

What I’ve Tried

  • Setting a custom start command in Railway to run bash start.sh

  • Making start.sh executable with git update-index --chmod=+x start.sh

  • Adding .nixpacks.toml to explicitly define build phases

  • Switching between Procfile and .nixpacks.toml

  • Confirmed requests is definitely listed in requirements.txt

Nothing seems to be triggering the install properly.

Any ideas why Railway isn't installing the requests package on build?

Would greatly appreciate help getting this resolved!

Thanks so much,
Alan (aka chidopro)

Solved

2 Replies

chidopro
HOBBYOP

10 months ago

Just checking in to see if anyone has thoughts on this. Still having the same issue where requests isn't being installed during deployment, even with a proper requirements.txt and start.sh. Any guidance would be amazing — thanks!


jake
EMPLOYEE

10 months ago

Would you mind trying to use railpack and seeing if that solves it?


Status changed to Awaiting User Response Railway • 10 months ago


Railway
BOT

6 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • 6 months ago


Loading...