non root location for requirements.txt breaks nixpacks build
0xmanny
PROOP

2 years ago

I attempted to build an api using nixpacks with the requirements.txt file outside of the root directory (e.g. src/requirements.txt). When doing this all builds failed with varying build commands.

What's the explanation for this behavior? Is there a way successfully build with requirements.txt outside of the root directory?

Thanks in advance!

10 Replies

0xmanny
PROOP

2 years ago

bf95cb17-c0de-4d0a-97ee-acebaffa2e01


2 years ago

is the rest of your project located in the src directory?


0xmanny
PROOP

2 years ago

The entry point to the api is but the railway.json is not


0xmanny
PROOP

2 years ago

I encountered command not found errors for pip, pip3, and python3


2 years ago

I would say you need to restructure your project


0xmanny
PROOP

2 years ago

I was able to build the project but am curious what the explanation is behind this behavior and if it's possible to work with a different project structure


2 years ago

requirements.txt being inside of src/ is pretty irregular for python projects. It's expected to be inside the root folder


2 years ago

If you'd like any advice on your app's folder structure, I'd be happy to help out. Just send your GH repo or a screenshot of your folder structure in your IDE


0xmanny
PROOP

2 years ago

thanks for offering. feel free to close.


hamzeh-pm
HOBBY

a year ago

i have same problem here

i create this file

nixpacks.toml

[variables]

BP_REQUIREMENTS_TXT_PATH = "requirements/production.txt"

[phases.setup]

nixPkgs = ["python312"]

[phases.install]

cmd = ["pip install -r requirements/production.txt"]

[start]

cmd = "./entrypoint.sh"

but it wont recognize my requirement/production.txt and when i see the plan it is always going for default requiements.txt in root. how to tell it to change the requirement.txt location on build


Welcome!

Sign in to your Railway account to join the conversation.

Loading...