I cannot Deploy my flask api using the railway.

Whenever i try to deploy my flask api i get this message in my build logs. 18 | ENV NIXPACKS_PATH /opt/venv/bin:$NIXPACKS_PATH Nov 30 18:07:36 19 | COPY . /app/. Nov 30 18:07:36 20 | >>> RUN --mount=type=cache,id=s/10748e15-fe21-49dc-b427-231f085ede2f-/root/cache/pip,target=/root/.cache/pip python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt Nov 30 18:07:36 21 | Nov 30 18:07:36 22 | Nov 30 18:07:36 ------------------- Nov 30 18:07:36 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 Nov 30 18:07:36 Nov 30 18:07:36 Error: Docker build failed I think the problem is related to the installation of requirements.txt. Also, I have attached the code of my main.py file and this is my requirements.txt file blinker==1.7.0 certifi==2023.11.17 charset-normalizer==3.3.2 click==8.1.7 colorama==0.4.6 contourpy==1.2.0 cycler==0.12.1 filelock==3.13.1 Flask==3.0.0 fonttools==4.45.1 fsspec==2023.10.0 huggingface-hub==0.19.4 idna==3.6 itsdangerous==2.1.2 Jinja2==3.1.2 kiwisolver==1.4.5 MarkupSafe==2.1.3 matplotlib==3.8.2 mpmath==1.3.0 networkx==3.2.1 numpy==1.26.2 opencv-python==4.8.1.78 packaging==23.2 Pillow==10.1.0 pyparsing==3.1.1 pytesseract==0.3.10 python-dateutil==2.8.2 PyYAML==6.0.1 regex==2023.10.3 requests==2.31.0 safetensors==0.4.1 six==1.16.0 sympy==1.12 tokenizers==0.15.0 torch==2.1.1 torchaudio==2.1.1 torchvision==0.16.1 tqdm==4.66.1 transformers==4.35.2 typing_extensions==4.8.0 urllib3==2.1.0 Werkzeug==3.0.1
22 Replies
Percy
Percy12mo ago
Project ID: 10748e15-fe21-49dc-b427-231f085ede2f
Brody
Brody12mo ago
please provide your build logs using this https://bookmarklets.up.railway.app/log-downloader/
Brody
Brody12mo ago
what version of python are you using locally?
nemesis_afk
nemesis_afkOP12mo ago
3.11.4
Brody
Brody12mo ago
add a runtime.txt file to your project with 3.11 in it
nemesis_afk
nemesis_afkOP12mo ago
thankyousomuch!! its working.
Brody
Brody12mo ago
awesome!
nemesis_afk
nemesis_afkOP12mo ago
The app deployed and crashed after a few minutes. Here is the Deploy log.
Brody
Brody12mo ago
make sure you have gunicorn in your requirements.txt file
nemesis_afk
nemesis_afkOP12mo ago
ohh okay
Brody
Brody12mo ago
hey wanting to follow up here, did my suggestion work?
nemesis_afk
nemesis_afkOP12mo ago
thanks. Yeah, your solution works, but there seems to be a problem with the flask api that I built, so I am working on resolving that.
Brody
Brody12mo ago
sounds good
nemesis_afk
nemesis_afkOP12mo ago
hey i am getting this on my deploy logs now
nemesis_afk
nemesis_afkOP12mo ago
and when i open the flask app it says "Application failed to respond". @Brody Help please!
Brody
Brody12mo ago
you should be using gunicorn
nemesis_afk
nemesis_afkOP12mo ago
I used gunicorn i am getting this on my deploy log the app hasn't crashed but it its not loading
nemesis_afk
nemesis_afkOP12mo ago
@Brody Help please!
Brody
Brody12mo ago
looks like you could be running out of memory, show me a screenshot of the service metrics please
nemesis_afk
nemesis_afkOP12mo ago
No description
Brody
Brody12mo ago
oh yeah for sure an out of memory issue, you will need to upgrade to hobby to get access to more than 512mb of memory
Want results from more Discord servers?
Add your server