WeasyPrint could not import some external libraries. Please carefully follow the installation steps

I don’t know what to do. I’ve tried to read the docs I don’t know if there’s a terminal I could use to install the dependencies myself.
42 Replies
Brody
Brody9mo ago
@Real_PyGod is this still an issue?
Real_PyGod
Real_PyGod9mo ago
Yes. It’s still an issue
Brody
Brody9mo ago
I'm just curious, may I ask why you ignored Percy's message?
Real_PyGod
Real_PyGod9mo ago
I dont know what I’m supposed to respond Please what could I have done instead? 🤲🏽
Brody
Brody9mo ago
what's your current start command
Real_PyGod
Real_PyGod9mo ago
For my project right?
Brody
Brody9mo ago
for your service
Real_PyGod
Real_PyGod9mo ago
gunicorn myshop.wsgi
Brody
Brody9mo ago
what version of python do you use locally
Real_PyGod
Real_PyGod9mo ago
3.11
Brody
Brody9mo ago
add this as a Dockerfile to your project
FROM python:3.11

ENV PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libjpeg-dev \
libopenjp2-7-dev \
libffi-dev \
libglib2.0-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD gunicorn myshop.wsgi
FROM python:3.11

ENV PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libjpeg-dev \
libopenjp2-7-dev \
libffi-dev \
libglib2.0-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD gunicorn myshop.wsgi
untested, but lets see where this takes us
Real_PyGod
Real_PyGod9mo ago
Oh. Ok I’d have to convert my project to docker first.
Brody
Brody9mo ago
no you dont
Real_PyGod
Real_PyGod9mo ago
I should create a docker file and add these and upload? I’m hosting on railway.app
Brody
Brody9mo ago
yes please try what ive asked no need to overthink anything
Real_PyGod
Real_PyGod9mo ago
Ok. Thank you. Let me do that right away. Wow. It worked. Thank you so much. 🙇🏽‍♂️🙇🏽‍♂️ I’m really grateful Please do you mind if I asked some questions?
Brody
Brody9mo ago
sure, ask away
Real_PyGod
Real_PyGod9mo ago
Please how did you know that would work? And please can you be my coach/mentor. I’d love to be as knowledgeable as you are so that I could also help others.
Brody
Brody9mo ago
ive looked at the docs for weasyprint, and wrote that dockerfile for someone else here in the past, so its nearly the same dockerfile i wrote for them, just needed to have your start command
Real_PyGod
Real_PyGod9mo ago
Wow. I never knew that Docker file could work on railway like that. I would have to take my time and learn docker properly. But please can you be my coach?
Brody
Brody9mo ago
unfortunately i cant, but this page can be your coach, get reading 😉 https://docs.docker.com/engine/reference/builder/
Real_PyGod
Real_PyGod9mo ago
Thank you. How about like a guide u probably use for Python I want to be a really good backend developer
Brody
Brody9mo ago
im not a python dev lol
Real_PyGod
Real_PyGod9mo ago
Oh wow.
Brody
Brody9mo ago
I want to be a really good backend developer
dont use python then
Real_PyGod
Real_PyGod9mo ago
I cant send you a request.
Brody
Brody9mo ago
jokes, kinda
Real_PyGod
Real_PyGod9mo ago
Wow. That’s a shocker How about FastApi?
Brody
Brody9mo ago
thats still python im only half joking, use what you want
Real_PyGod
Real_PyGod9mo ago
Yes. I was asking if it wasn’t good enough. I feel like there’s some reason u said that. I’d love to know so I can be on my best and gain knowledge
Brody
Brody9mo ago
not language bashing, but python has a significantly higher resource footprint compared to rust or go, aka python will cost more to run i run golang web services on railway for sub 20 cents a month
Real_PyGod
Real_PyGod9mo ago
That’s a fact. An I intend learning go next
Brody
Brody9mo ago
love to hear that i went from python to go a while ago
Real_PyGod
Real_PyGod9mo ago
Oh wow. 😁😁 I might be following your lead sir
Brody
Brody9mo ago
awsome!
Real_PyGod
Real_PyGod9mo ago
Thank you
Brody
Brody9mo ago
no problem!
Real_PyGod
Real_PyGod9mo ago
🙌🙌 You made my day sir. I really appreciate I’d learn so I can be as knowledgeable as you are and help others.
Brody
Brody9mo ago
thats very nice to hear, love the enthusiasm
Real_PyGod
Real_PyGod9mo ago
🙌🙌 Yes sir. Please one more question. Is it possible to have an smtp set up on railway just like in a Cpanel?
Brody
Brody9mo ago
it might be possible, but I would not recommend it, you would have to manage it yourself just use Zoho mail for business
Real_PyGod
Real_PyGod9mo ago
Thank you so much.