2 years ago
Hello I am really new to railway so I have no clue what is wrong with my deployment as I can run everything fine locally. I noticed this warning message in the logs if that helps:
2 warnings found (use --debug to expand):
UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)
LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)
Dockerfile:20
18 | ENV NIXPACKSPATH /opt/venv/bin:$NIXPACKSPATH
19 | COPY . /app/.
20 | >>> RUN --mount=type=cache,id=s/78cea037-eee2-4516-b4b5-d402d667bf8a-/root/cache/pip,target=/root/.cache/pip python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt
21 |
22 | # build phase
ERROR: failed to solve: process "/bin/bash -ol pipefail -c python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 1
ⓘ Deployment information is only viewable by project members and Railway employees.
42 Replies
2 years ago
You have incorrectly set pip install -r requirements.txt as your build command, that command is automatically ran in the install phase, so running it twice is not the best idea, please remove the build command.
What python version do you use locally?
2 years ago
python version 3.11.3
2 years ago
Just 3.11 and nothing else?
2 years ago
Ok, I did all the changes and now my full logs are like this
Attachments
2 years ago
Please attach your requirements.txt file.
Is there something I can do to fix my issue?
2 years ago
syi, that is a 147 dependencies, please work towards removing the deps your app does not use.
2 years ago
But all of those I got from a pip freeze in a free environment where I had to do necessary pip installs of libraries.
2 years ago
But just in case, I did try bringing it down to 30 100% necessary libs but I still get the same deployment fail
2 years ago
Oh, I meant just a new fresh environment. 
2 years ago
Are you sure the versions in your requirements.txt file are the same as what you have installed locally?
2 years ago
yes
2 years ago
Ok, I upgraded it to 4.3.2 and is currently building, will let you know if any errors pop up thank you! 
2 years ago
The deployment seems to work but now it is crashing at the end. I am assuming it is just a lack of mem because I am using a free version which should be a quick fix that I can do on my own, so I just wanted to honestly say thank you so much for all your help. Appreciate the help Brody
.
2 years ago
Awesome, from what I saw about gensim it doesn't seem like something that could be used with only 500MB of memory, but you are also running a development server as far as I can tell? fastapi dev app.py if that is starting a development server, you would be using a lot of unnecessary resources and increased instabilities, I would highly recommend switching to uvicorn.
2 years ago
Would that be an easy change to do?
2 years ago
Well first off, how are you currently defining the start command that Railway is using?
2 years ago
I set a custom start command of fastapi dev app.py
2 years ago
yeah
2 years ago
First, make sure you have uvicorn in your requirements.txt.
Then try changing the start command to uvicorn app:app --host 0.0.0.0 --port $PORT
The first app is for app.py and the second app is for what the FastAPI constructor is typically named, change that as needed.
2 years ago
I made the changes and the deployment ended up failing about 5 mins in. Here are the logs:
Attachments
2 years ago
Yeah, I think so. Its just stuck there and I was told that it failed.
2 years ago
Got it
2 years ago
Ok, it finished building but now the deploys logs constantly repeats container event container restart and occasionally shows container died as well, like this:
Starting Container
container event container restart
container event container restart
container event container restart
container event container restart
container event container died
2 years ago
To rule out the trial plan being an issue, may I ask you to upgrade to Hobby and redeploy? if you continue to experience such issues, i'll likely get the team involved.
2 years ago
I do believe it is a trial plan issue as I know that running my application is a bit demanding to run. I faced similar problem when trying to deploy using other providers. If I find it impossible to deploy my app for free in other app deploying sites, I will definitely consider trying the upgrade to Hobby. But overall, thank you for all the help, Brody!
2 years ago
No problem, let me know if you continue to experience issues after the upgrade! I'll leave this thread open.