R
Railway6mo ago
KiLo89

Deployment Failed during build process

I am getting Deployment failed, even though nothing has changed in my configuration recently. The two error messages in build log: math -Ibuild/src.linux-x86_64-3.1/numpy/core/src/common -Ibuild/src.linux-x86_64-3.1/numpy/core/src/npymath -c numpy/core/src/multiarray/scalarapi.c -o build/temp.linux-x86_64-cpython-311/numpy/core/src/multiarray/scalarapi.o -MMD -MF build/temp.linux-x86_64-cpython-311/numpy/core/src/multiarray/scalarapi.o.d" failed with exit status 1 #10 267.6 ERROR: Failed building wheel for numpy I'm using Django 3.2.18 numpy 1.16.4 pandas 1.1.5 Any ideas why the build is failing? Thank you.
Solution:
try this - ```dockerfile FROM python:3.8-buster ENV PYTHONUNBUFFERED 1...
Jump to solution
67 Replies
Percy
Percy6mo ago
Project ID: da285e3a-b7b2-4c5a-a383-0e7f536ba2ac
KiLo89
KiLo89OP6mo ago
Project ID: da285e3a-b7b2-4c5a-a383-0e7f536ba2ac
KiLo89
KiLo89OP6mo ago
Brody, were you able to find anything in the logs that's causing the build to fail?
Brody
Brody6mo ago
I mean, you just sent them so I haven't looked yet, but you seem to assume I had already somehow read your logs before you sent them?
KiLo89
KiLo89OP6mo ago
Ya sorryI though I sent you the log yesterday but somehow the logs were in limbo state on my computer
Brody
Brody6mo ago
what version of python do you use locally
KiLo89
KiLo89OP6mo ago
Python 3.8.10
Brody
Brody6mo ago
can you try putting just 3.8 into a runtime.txt file in your project
KiLo89
KiLo89OP6mo ago
I changed runtime.txt to just python 3.8 , did a git push to remote, where Railway picked up the push, but still getting deployment failed Here is the log,
KiLo89
KiLo89OP6mo ago
Brody, is there anything else you want me to try?
Brody
Brody6mo ago
honestly, I'm stumped, at this point I'm gonna ask you to move to a Dockerfile based build
KiLo89
KiLo89OP6mo ago
The build has been working for months, what has changed? I don't know what a Dockerfile based build is, can you provide some instructions?
Brody
Brody6mo ago
a Dockerfile based build would not be anything railway specific, so it would be of great help if you were able to familiarize yourself with the topics at hand
Adam
Adam6mo ago
By default, Railway builds your app using nixpacks, their in house builder. It seems to be having issues with building your app, so Brody is suggesting you swap to a Dockerfile. Dockerfiles are instructions for Railway (or other cloud services) to build a Dockerized container for your app. You can make it more prescriptive and include exactly what your app needs, rather than relying on Nixpacks to make decisions for you, which it seems to be doing wrong in this case. Railway will automatically build off a Dockerfile if you include the file named “Dockerfile” in your project’s root directory
Adam
Adam6mo ago
Here are the Dockerfile docs: https://docs.docker.com/reference/dockerfile/
Docker Documentation
Dockerfile reference
Find all the available commands you can use in a Dockerfile and learn how to use them, including COPY, ARG, ENTRYPOINT, and more.
Adam
Adam6mo ago
@Brody I don’t want to send them off the deep end without any help, do you have any example dockerfiles available to share?
Brody
Brody6mo ago
Dockerfiles definitely aren't the deep end, any basic python Dockerfile will do with some minor modifications
KiLo89
KiLo89OP6mo ago
Adam, Brody: What has changed with these “nixpacks”. My app has been running for a while with no issues, and then this happens now out of the blue. I’ve got a 2nd app with Railway, and now it is giving the same build error: “ERROR: Failed building wheel for numpy”. What I am hearing is that this nixpack system can be flaky and going to a Dockerfile based build will be much more reliable on Railway. So I guess I will have to invest the time to do that.
Brody
Brody6mo ago
there have been multiple recent updates to nixpacks, so yes for some people nixpacks can be flakey, a Dockerfile will always be the way to go so that you have complete control over your build, that way if you build breaks it wouldn't be someone else's fault by no means are Dockerfiles complicated, please don't overthink this
KiLo89
KiLo89OP6mo ago
Brody I created the Dockerfile for my app and I tried not to overthink it as you recommended but I am stumped now. After creating the Dockerfile, I deployed to Railway. I see 'deployment successful', but when I open a browser and launch my app I'm getting "Application failed to respond". I don't see any errors in the build log. What am I doing wrong?
KiLo89
KiLo89OP6mo ago
Here's the build log
KiLo89
KiLo89OP6mo ago
Here's my Dockerfile FROM python:3.8-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /equick
WORKDIR /equick
COPY requirements.txt /equick/ RUN pip install --user -r requirements.txt COPY . /equick/ ARG DATABASE_URL ARG DEBUG ARG DJSTRIPE_WEBHOOK_SECRET ARG MAINTENANCE_MODE ARG PGDATABASE ARG PGHOST ARG PGPASSWORD ARG PGPORT ARG PGUSER ARG SECRET_KEY ARG SENDGRID_API_KEY ARG STRIPE_LIVE_MODE ARG STRIPE_LIVE_SECRET_KEY ARG STRIPE_PRICE_ID ARG STRIPE_PUBLISHABLE_KEY ARG STRIPE_TEST_SECRET_KEY ARG domain_url ARG dsn CMD python3 manage.py runserver
Brody
Brody6mo ago
python3 manage.py runserver is a development server, please use gunicorn
KiLo89
KiLo89OP6mo ago
Brody, I changed in my docker file 'CMD python3 manage.py runserver ' to 'CMD gunicorn equick.wsgi' but I'm still getting "Application failed to respond". Have I got the CMD correct?
Brody
Brody6mo ago
send your deploy logs please
KiLo89
KiLo89OP6mo ago
Here's the deploy logs
Brody
Brody6mo ago
are you setting your start command somewhere else like in the service settings
KiLo89
KiLo89OP6mo ago
I have a PROCFILE with this setting web: python manage.py migrate && gunicorn equick.wsgi
Brody
Brody6mo ago
that's overwriting the CMD in your Dockerfile, you can remove it
KiLo89
KiLo89OP6mo ago
Brody I removed the PROCFILE and redeployed but still getting Application failed to respond
Brody
Brody6mo ago
deployment logs please
KiLo89
KiLo89OP6mo ago
Here's the deployment log
Brody
Brody6mo ago
do what it says and then deploy the changes
KiLo89
KiLo89OP6mo ago
I did the makemigrations and migrate: railway run python manage.py migrate
Select a service to pull variables from web
Operations to perform: Apply all migrations: account, admin, auth, contenttypes, datainput, django_summernote, djstripe, idea, login_history, posts, sessions, sites, subscribers, user_accounts Running migrations: Applying django_summernote.0003_alter_attachment_id... OK Looking good? Run railway up to deploy your changes! I did a redeploy, and still getting "Application failed to respond"
KiLo89
KiLo89OP6mo ago
Here's the deploy log
Brody
Brody6mo ago
you need to deploy the changes to github
KiLo89
KiLo89OP6mo ago
Brody, I did the migrate and makemigrations then git push to Github -iMac equick % python3 manage.py makemigrations No changes detected (equick) iMac equick % python3 manage.py migrate
Operations to perform: Apply all migrations: account, admin, auth, contenttypes, datainput, django_summernote, djstripe, idea, login_history, posts, sessions, sites, subscribers, user_accounts Running migrations: No migrations to apply. still getting "Application failed to respond"
Brody
Brody6mo ago
please use the bookmarklet to send me the latest logs from railway
KiLo89
KiLo89OP6mo ago
here are the logs
Brody
Brody6mo ago
Your models in app(s): 'django_summernote' have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
Your models in app(s): 'django_summernote' have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
please remedy this before proceeding
KiLo89
KiLo89OP5mo ago
Brody, the migration issue has been remedied but still getting "Application failed to respond". Here's the deployment log
Brody
Brody5mo ago
what's your current start command?
KiLo89
KiLo89OP5mo ago
when you say start command are you referring to the CMD statement in the dockerfile? If so, it is: CMD gunicorn equick.wsgi
Brody
Brody5mo ago
I'm talking about the command that railway will be running
KiLo89
KiLo89OP5mo ago
It is: python manage.py migrate && gunicorn equick.wsgi
Brody
Brody5mo ago
then that means your migrate command is exiting prematurity for whatever reason and not allowing gunicorn to run, please look into that
KiLo89
KiLo89OP5mo ago
How do I look into that? It was running before when I was using Nixpack method.
Brody
Brody5mo ago
this would be an issue with your code
KiLo89
KiLo89OP5mo ago
I don't think it is existing prematurely because there is nothing to migrate, that's why it says "no migrations to apply"
Brody
Brody5mo ago
then it's exciting with an error, fact of the matter is that gunicorn never gets ran because something in the migrate command is preventing it
KiLo89
KiLo89OP5mo ago
If it's exiting with an error wouldn't the build or deploy logs show that. Everything looks good. You said going "Dockerfiles complicated, please don't overthink this" but I have worked on this for days with no real progress.
Brody
Brody5mo ago
okay then if you haven't made any progress, don't have the start command run migrations
KiLo89
KiLo89OP5mo ago
I not sure what you mean, should I clear out the start command, and just leave blank?
No description
Brody
Brody5mo ago
correct
KiLo89
KiLo89OP5mo ago
I removed the start command, redeployed, but redeployment crashed
Brody
Brody5mo ago
you need gunicorn in your requirements
KiLo89
KiLo89OP5mo ago
I do have gunicorn in my requirements.txt file. The build logs show tht gunicorn is being installed:
No description
Brody
Brody5mo ago
your deploy logs disagree
KiLo89
KiLo89OP5mo ago
Brody, I am so confused. I thought you said using a Dockerfile would be straight forward? If the build log says Gunicorn is installed, but deploy log says it can’t find Gunicorn… so what should I do? I’ve been working on this Dockerfile method for weeks, should I try going back to Nixpack? Do you have a successful working dockerfile for a python/django application that I can copy? I’m totally lost. I need some direction from you or one of your colleagues.
Brody
Brody5mo ago
please attach your dockerfile
KiLo89
KiLo89OP5mo ago
Brody, here's my Dockerfile
Solution
Brody
Brody5mo ago
try this -
FROM python:3.8-buster

ENV PYTHONUNBUFFERED 1

WORKDIR /equick

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD gunicorn equick.wsgi
FROM python:3.8-buster

ENV PYTHONUNBUFFERED 1

WORKDIR /equick

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD gunicorn equick.wsgi
and if you still have a start command set in the service settings remove it, same goes for a Procfile
KiLo89
KiLo89OP5mo ago
Brody, ...Bingo, OMG it's up and running now! That Dockerfile is really simple. It took awhile to figure this out. Thanks for your help!
Brody
Brody5mo ago
told you not to complicate things
Want results from more Discord servers?
Add your server