2 years ago
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [5 lines of output]
:117: SyntaxWarning: invalid escape sequence '.'
Building lxml version 4.9.2.
:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Building without Cython.
Error: Please make sure the libxml2 and libxslt development packages are installed.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. I have an emergency and Docker is giving an error when installing requirements.txt, after I added the python-docx library
107 Replies
2 years ago
Looks like python-docx has a few requirements that aren’t installed. You can install them using a nixpacks.toml with the package names in the “setup” step.
2 years ago
the package names must be nix packages, here’s where you can search them.
You need libxml2 - https://search.nixos.org/packages?channel=24.11&from=0&size=50&sort=relevance&type=packages&query=libxml2
And libxslt - https://search.nixos.org/packages?channel=24.11&from=0&size=50&sort=relevance&type=packages&query=libxslt
2 years ago
although, you mentioned docker error. Are you building from a Dockerfile?
2 years ago
create a nixpacks.toml file in your root directory, follow the docs to add the two packages to the “setup” section
Aonde Where is the documentation? So I know what exactly to add to nixpacks.toml?
2 years ago
It is linked above. https://nixpacks.com/docs/configuration/file
2 years ago
Add this file to your root directory
2 years ago
.txt
2 years ago
it's a .toml
2 years ago
am I missing something
2 years ago
.toml.txt
unless discord is appending .txt
2 years ago
I'm not seeing that
2 years ago
also doesn't say that on my pc, I changed the extension
2 years ago
@henriquejesus make sure the extension is .toml before you push, seems like Discord may be acting weird
I added the file to the project root and deployed it, but I kept getting the same error. Did I forget a process?
2 years ago
please send your entire logs
2 years ago
oh, you have a railway.json? add this code to it.
"build": {
"nixpacksConfigPath": "nixpacks.toml"
}
2 years ago
according to these docs
https://docs.railway.com/reference/config-as-code#configurable-settings
2 years ago
their nixpacks.toml was successfully being used already
2 years ago
Go ahead and take over if you have time Brody, i’m about to get into an hour meeting at work lol
2 years ago
Dockerfile time
2 years ago
how can you tell though?
2 years ago
woohoo
2 years ago
i can read their full logs
2 years ago
cheater
2 years ago
yeah 😦
2 years ago
thats not important
2 years ago
You will need to move to a Dockerfile based build
2 years ago
Writng a Dockerfile for python wouldn't be specific to Railway, so there would be many great guides for it
2 years ago
its just a text file, nothing scary
In this case, to avoid bugs, it would be good for me to imitate railway django's default docker configuration, right?
2 years ago
nope, you would want to write your own Dockerfile
2 years ago
good start, give it to me in text please
2 years ago
do you need to be using daphne?
2 years ago
close
2 years ago
do you use python 3.9 locally?
2 years ago
try this -
FROM python:3.10.7
ENV PYTHONFAULTHANDLER=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONHASHSEED=random
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_DEFAULT_TIMEOUT=100
RUN apt-get update && \
apt-get install -y libxml2-dev libxslt-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . ./
CMD daphne -b 0.0.0.0 -p $PORT seupedido.asgi:application2 years ago
just Dockerfile no extention
2 years ago
looks like your latest build is building now
2 years ago
use this railway.json file -
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "DOCKERFILE"
},
"deploy": {
"preDeployCommand": "python manage.py migrate",
"startCommand": "python manage.py collectstatic --noinput && daphne -b 0.0.0.0 -p $PORT seupedido.asgi:application",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}2 years ago
leave it how i set please
I tested with the new settings but it didn't work. Then I need to go back to an older version
2 years ago
something you are doing in code is causing anything ran with manage.py to prematurely exit
2 years ago
^
But my manage.py code is the same as always. It appears that the daphne server is simply not starting
2 years ago
please look into that
2 years ago
i think you can use gunicorn with a uvicorn event worker for this instead of daphne
2 years ago
i think so
2 years ago
i dont see any issues, please try gunicorn with a uvicorn event worker
2 years ago
yes
I don't know how to do what you told me, wouldn't there be another way I could keep using daphne?
I'm sorry for all this inconvenience, but I'm simply very worried about what to do, since I'm having to change the structural part
2 years ago
change your start command
In the past I needed to switch to daphne, after trying several others without success. I'm worried about needing something like this again
2 years ago
have you tried gunicorn with a uvicorn event worker?
gunicorn seupedido.asgi:application --bind 0.0.0.0:$PORT --workers 3 --worker-class uvicorn.workers.UvicornWorker?
2 years ago
looks about right
2 years ago
why is that
2 years ago
please describe "didn't work"
I don't understand why the first command to start the server is not being executed
2 years ago
send your start script please
Base image
FROM python:3.10.7-slim
Definir o diretório de trabalho
WORKDIR /app
Instalar dependências de sistema necessárias
RUN apt-get update && apt-get install -y
build-essential
libxml2-dev
libxslt-dev
libpq-dev
&& apt-get clean
Copiar os arquivos de requisitos para o contêiner
COPY requirements.txt /app/
Instalar as dependências do Python
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app/
RUN python manage.py collectstatic --noinput
Copiar o script de inicialização e adicionar permissão de execução
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
EXPOSE 8000
CMD ["./start.sh"], I solved it with a start code outside
2 years ago
thats your dockerfile not the start script
2 years ago
and please enclose in a code block
#!/bin/bash
Rodar migrações do Django
python manage.py migrate
Coletar arquivos estáticos
python manage.py collectstatic --noinput
Iniciar o servidor Daphne
daphne -b 0.0.0.0 -p 8000 seupedido.asgi:application
2 years ago
^







