R
Railway9mo ago
lynn

glibc missing from deployment

I have a simple fastapi python server running on railway, that uses libreoffice in headless mode to convert a docx to a pdf. I keep on running into an error on api invocation that tells me
/usr/lib/libreoffice/program/soffice.bin: /nix/store/wprxx5zkkk13hpj6k1v6qadjylh3vq9m-gcc-11.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/lib/libreoffice/program/libmergedlo.so)

/usr/lib/libreoffice/program/soffice.bin: /nix/store/wprxx5zkkk13hpj6k1v6qadjylh3vq9m-gcc-11.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/lib/libreoffice/program/libuno_cppu.so.3)
/usr/lib/libreoffice/program/soffice.bin: /nix/store/wprxx5zkkk13hpj6k1v6qadjylh3vq9m-gcc-11.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/lib/libreoffice/program/libmergedlo.so)

/usr/lib/libreoffice/program/soffice.bin: /nix/store/wprxx5zkkk13hpj6k1v6qadjylh3vq9m-gcc-11.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/lib/libreoffice/program/libuno_cppu.so.3)
I've ensured that they're installed with my deployment config
"nixpacksPlan": {
"phases": {
"setup": {
"aptPkgs": [
"...",
"libreoffice",
"libstdc++6"
],
"nixPkgs": [
"...",
"glibc"
]
}
}
},
"nixpacksPlan": {
"phases": {
"setup": {
"aptPkgs": [
"...",
"libreoffice",
"libstdc++6"
],
"nixPkgs": [
"...",
"glibc"
]
}
}
},
I did see in another thread that setting nixpacks to 1.15.0 could help, but neither the latest (no version specified) nor 1.15.0 work for this issue. Project ID: 11af6aaa-78aa-4cb0-bf8b-a5e6dfafc4b9 Any help would be greatly appreciated 🙏
Solution:
give this Dockerfile a try ```dockerfile FROM python:3.10 ENV PYTHONFAULTHANDLER=1...
Jump to solution
21 Replies
Percy
Percy9mo ago
Project ID: 11af6aaa-78aa-4cb0-bf8b-a5e6dfafc4b9
Brody
Brody9mo ago
i think ive helped another user run a deploy that used libreoffice in some capacity, we ended up using a dockerfile, let me see if i can find it, otherwise ill write you a new one nope, can't find it, can you share your repo so that i can see about writing you a dockerfile?
lynn
lynn9mo ago
of course, could I get your github username please?
Brody
Brody9mo ago
brody192
lynn
lynn9mo ago
ok, shared! the api route itself is /retrieve/docx
Brody
Brody9mo ago
i havent gotten any emails or gh notifications got it now
lynn
lynn9mo ago
I just removed and re-added, it should show up soon
Brody
Brody9mo ago
looking what version of python do you use locally
lynn
lynn9mo ago
3.10
Solution
Brody
Brody9mo ago
give this Dockerfile a try
FROM python:3.10

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 --no-install-recommends \
gcc \
libreoffice \
libstdc++6

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD uvicorn main:app --host 0.0.0.0 --port $PORT
FROM python:3.10

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 --no-install-recommends \
gcc \
libreoffice \
libstdc++6

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD uvicorn main:app --host 0.0.0.0 --port $PORT
Brody
Brody9mo ago
if there are build errors use this to download the logs and then send them here https://bookmarklets.up.railway.app/log-downloader/
lynn
lynn9mo ago
silly question - but it's simply copied and pasted into Dockerfile right? I got ERROR: failed to solve: dockerfile parse error on line 3: unknown instruction: PYTHONFAULTHANDLER=1
Brody
Brody9mo ago
well i knew something felt off, my bad
lynn
lynn9mo ago
all good, I really appreciate the help
Brody
Brody9mo ago
fixed
lynn
lynn9mo ago
seems like the build passed fine, now I get the following when trying to start Error: Invalid value for '--port': '$PORT' is not a valid integer. the $PORT var is supposed to be the port railway assigns
Brody
Brody9mo ago
new railway.json
{
"$schema": "https://schema.up.railway.app/railway.schema.json",
"build": {
"watchPatterns": [
"/apps/fastapi/**"
]
},
"deploy": {
"region": "us-east4",
"numReplicas": 4,
"healthcheckPath": "/health",
"healthcheckTimeout": 300,
"sleepApplication": false,
"restartPolicyType": "ALWAYS"
}
}
{
"$schema": "https://schema.up.railway.app/railway.schema.json",
"build": {
"watchPatterns": [
"/apps/fastapi/**"
]
},
"deploy": {
"region": "us-east4",
"numReplicas": 4,
"healthcheckPath": "/health",
"healthcheckTimeout": 300,
"sleepApplication": false,
"restartPolicyType": "ALWAYS"
}
}
i assume you're doing railway up since i dont see the Dockerfile in your repo?
lynn
lynn9mo ago
ah - sorry, it was copied over from a monorepo
Brody
Brody9mo ago
oh, gotcha
lynn
lynn9mo ago
ok! seems like I'm not getting the errors anymore (at least, they're not related to glibc), thank you for the help!
Brody
Brody9mo ago
awsome!
Want results from more Discord servers?
Add your server