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.
67 Replies
Project ID:
da285e3a-b7b2-4c5a-a383-0e7f536ba2ac
Project ID: da285e3a-b7b2-4c5a-a383-0e7f536ba2ac
full build logs please - https://bookmarklets.up.railway.app/log-downloader/
Brody, were you able to find anything in the logs that's causing the build to fail?
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?
Ya sorryI though I sent you the log yesterday but somehow the logs were in limbo state on my computer
what version of python do you use locally
Python 3.8.10
can you try putting just
3.8
into a runtime.txt file in your projectI 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,
Brody, is there anything else you want me to try?
honestly, I'm stumped, at this point I'm gonna ask you to move to a Dockerfile based build
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?
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
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
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.
@Brody I don’t want to send them off the deep end without any help, do you have any example dockerfiles available to share?
Dockerfiles definitely aren't the deep end, any basic python Dockerfile will do with some minor modifications
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.
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
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?
Here's the build log
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
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
python3 manage.py runserver
is a development server, please use gunicornBrody, 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?
send your deploy logs please
Here's the deploy logs
are you setting your start command somewhere else like in the service settings
I have a PROCFILE with this setting
web: python manage.py migrate && gunicorn equick.wsgi
that's overwriting the CMD in your Dockerfile, you can remove it
Brody I removed the PROCFILE and redeployed but still getting Application failed to respond
deployment logs please
Here's the deployment log
do what it says and then deploy the changes
I did the makemigrations and migrate:
railway run python manage.py migrate
Select a service to pull variables from webOperations 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"Here's the deploy log
you need to deploy the changes to github
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"
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"
please use the bookmarklet to send me the latest logs from railway
here are the logs
please remedy this before proceeding
Brody, the migration issue has been remedied but still getting "Application failed to respond". Here's the deployment log
what's your current start command?
when you say start command are you referring to the CMD statement in the dockerfile? If so, it is: CMD gunicorn equick.wsgi
I'm talking about the command that railway will be running
It is: python manage.py migrate && gunicorn equick.wsgi
then that means your migrate command is exiting prematurity for whatever reason and not allowing gunicorn to run, please look into that
How do I look into that? It was running before when I was using Nixpack method.
this would be an issue with your code
I don't think it is existing prematurely because there is nothing to migrate, that's why it says "no migrations to apply"
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
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.
okay then if you haven't made any progress, don't have the start command run migrations
I not sure what you mean, should I clear out the start command, and just leave blank?
correct
I removed the start command, redeployed, but redeployment crashed
you need gunicorn in your requirements
I do have gunicorn in my requirements.txt file. The build logs show tht gunicorn is being installed:
your deploy logs disagree
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.
please attach your dockerfile
Brody, here's my Dockerfile
Solution
try this -
and if you still have a start command set in the service settings remove it, same goes for a Procfile
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!
told you not to complicate things