5 months 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: pkgresources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkgresources.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
0 Replies
5 months 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.
5 months 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
5 months ago
although, you mentioned docker error. Are you building from a Dockerfile?
5 months 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?
5 months ago
It is linked above. https://nixpacks.com/docs/configuration/file
5 months ago
Add this file to your root directory
5 months ago
.txt
5 months ago
it's a .toml
5 months ago
am I missing something
5 months ago
.toml.txt
unless discord is appending .txt
5 months ago
I'm not seeing that
5 months ago
also doesn't say that on my pc, I changed the extension
5 months 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?
5 months ago
please send your entire logs
5 months ago
oh, you have a railway.json? add this code to it.
"build": {
"nixpacksConfigPath": "nixpacks.toml"
}
5 months ago
according to these docs
https://docs.railway.com/reference/config-as-code#configurable-settings
5 months ago
their nixpacks.toml was successfully being used already
5 months ago
Go ahead and take over if you have time Brody, i’m about to get into an hour meeting at work lol
5 months ago
Dockerfile time
5 months ago
how can you tell though?
5 months ago
woohoo
5 months ago
i can read their full logs
5 months ago
cheater
5 months ago
yeah 😦
5 months ago
thats not important
5 months ago
You will need to move to a Dockerfile based build
5 months ago
Writng a Dockerfile for python wouldn't be specific to Railway, so there would be many great guides for it
5 months 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?
5 months ago
nope, you would want to write your own Dockerfile
5 months ago
good start, give it to me in text please
5 months ago
do you need to be using daphne?
5 months ago
close
5 months ago
do you use python 3.9 locally?
5 months 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:application
5 months ago
just Dockerfile
no extention
5 months ago
looks like your latest build is building now
5 months 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
}
}
5 months 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
5 months ago
something you are doing in code is causing anything ran with manage.py to prematurely exit
5 months ago
^
But my manage.py code is the same as always. It appears that the daphne server is simply not starting
5 months ago
please look into that
5 months ago
i think you can use gunicorn with a uvicorn event worker for this instead of daphne
5 months ago
i think so
5 months ago
i dont see any issues, please try gunicorn with a uvicorn event worker
5 months 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
5 months 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
5 months 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?
5 months ago
looks about right
5 months ago
why is that
5 months ago
please describe "didn't work"
I don't understand why the first command to start the server is not being executed
5 months 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
5 months ago
thats your dockerfile not the start script
5 months ago
and please enclose in a code block
5 months ago
^