R
Railway9mo ago
salzar

[glibc] apt-get failing error code 1

Hi everyone, Im getting the error below when trying to install gcc libpq-dev. I have my env settup properly for Nixpacks as I attached in the image. why would this error occur?
7 | COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix

8 | RUN nix-env -if .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix && nix-collect-garbage -d

9 | >>> RUN apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev

10 |

11 | ARG CODEBOX_API_KEY HISTORY_BACKEND NIXPACKS_APT_PKGS NIXPACKS_METADATA OPENAI_API_KEY POSTGRES_URL PYTHONUNBUFFERED RAILWAY_ENVIRONMENT RAILWAY_ENVIRONMENT_ID RAILWAY_ENVIRONMENT_NAME RAILWAY_GIT_AUTHOR RAILWAY_GIT_BRANCH RAILWAY_GIT_COMMIT_MESSAGE RAILWAY_GIT_COMMIT_SHA RAILWAY_GIT_REPO_NAME RAILWAY_GIT_REPO_OWNER RAILWAY_PRIVATE_DOMAIN RAILWAY_PROJECT_ID RAILWAY_PROJECT_NAME RAILWAY_PUBLIC_DOMAIN RAILWAY_SERVICE_FILEUNIT_DOCKER_URL RAILWAY_SERVICE_ID RAILWAY_SERVICE_NAME RAILWAY_STATIC_URL SUPABASE_JWT_SECRET SUPABASE_KEY SUPABASE_URL VERBOSE

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev" did not complete successfully: exit code: 1



Error: Docker build failed
7 | COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix

8 | RUN nix-env -if .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix && nix-collect-garbage -d

9 | >>> RUN apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev

10 |

11 | ARG CODEBOX_API_KEY HISTORY_BACKEND NIXPACKS_APT_PKGS NIXPACKS_METADATA OPENAI_API_KEY POSTGRES_URL PYTHONUNBUFFERED RAILWAY_ENVIRONMENT RAILWAY_ENVIRONMENT_ID RAILWAY_ENVIRONMENT_NAME RAILWAY_GIT_AUTHOR RAILWAY_GIT_BRANCH RAILWAY_GIT_COMMIT_MESSAGE RAILWAY_GIT_COMMIT_SHA RAILWAY_GIT_REPO_NAME RAILWAY_GIT_REPO_OWNER RAILWAY_PRIVATE_DOMAIN RAILWAY_PROJECT_ID RAILWAY_PROJECT_NAME RAILWAY_PUBLIC_DOMAIN RAILWAY_SERVICE_FILEUNIT_DOCKER_URL RAILWAY_SERVICE_ID RAILWAY_SERVICE_NAME RAILWAY_STATIC_URL SUPABASE_JWT_SECRET SUPABASE_KEY SUPABASE_URL VERBOSE

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev" did not complete successfully: exit code: 1



Error: Docker build failed
No description
36 Replies
Percy
Percy9mo ago
Project ID: N/A
salzar
salzar9mo ago
I cant get that to work for some reason, wont drag to my bookmarks, but I can copy and paste the full build log
Brody
Brody9mo ago
add a railway.toml file to your project with this in it
[build]
nixpacksVersion = "1.15.0"
[build]
nixpacksVersion = "1.15.0"
salzar
salzar9mo ago
I’ll try it out when I get home from work and I’ll let you know thank you That works thanks!
L
L9mo ago
brody gody
salzar
salzar9mo ago
One thing tho, I notice that when I either redeploy or push a new change to github, its not saying the libpq-dev package is missing. It worked the first time tho. Is there a way I can purge cache or something? I have a feeling thats what causing it `File "/opt/venv/lib/python3.11/site-packages/psycopg/pq/__init__.py", line 114, in <module> import_from_libpq() File "/opt/venv/lib/python3.11/site-packages/psycopg/pq/__init__.py", line 106, in import_from_libpq raise ImportError( ImportError: no pq wrapper available. Attempts made: - couldn't import psycopg 'c' implementation: No module named 'psycopg_c' - couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary' - couldn't import psycopg 'python' implementation: libpq library not found
Brody
Brody9mo ago
if it is a cache issue set a service variable NIXPACKS_NO_CACHE to 1
jr
jr9mo ago
What does your requirements.txt look like? Curious what about the missing postgres package
salzar
salzar9mo ago
uvicorn
codeinterpreterapi @ git+https://github.com/salvinoto/codeinterpreter-api.git@main
pyjwt
psycopg
websockets
uvicorn
codeinterpreterapi @ git+https://github.com/salvinoto/codeinterpreter-api.git@main
pyjwt
psycopg
websockets
Thats requirements.txt
salzar
salzar9mo ago
hmm i tried that still getting same error This is the full logs if its helpful
Brody
Brody9mo ago
replace psycopg with psycopg-binary 🙂
salzar
salzar9mo ago
I did try that, but I guess the package im using relies on psycopg 1 not 2 so its causing some sorta problem
Brody
Brody9mo ago
what browser are you using?
salzar
salzar9mo ago
Chrome
Brody
Brody9mo ago
do you have the bookmarks bar set to always display?
salzar
salzar9mo ago
Yes
No description
salzar
salzar9mo ago
oh i just read that brain dead guest mode smh
Brody
Brody9mo ago
also, you dont have the bookmarks bar set to always display
Brody
Brody9mo ago
No description
salzar
salzar9mo ago
Brody
Brody9mo ago
build logs also please
Brody
Brody9mo ago
do you have something set in your build command in the service settings?
salzar
salzar9mo ago
builder = "nixpacks"
nixpacksVersion = "1.15.0"
buildCommand = "pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt"

[deploy]
startCommand = "uvicorn api:app --host 0.0.0.0 --port $PORT"
restartPolicyType = "never"
builder = "nixpacks"
nixpacksVersion = "1.15.0"
buildCommand = "pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt"

[deploy]
startCommand = "uvicorn api:app --host 0.0.0.0 --port $PORT"
restartPolicyType = "never"
Thats my my railway.toml
Brody
Brody9mo ago
remove the buildCommand line
salzar
salzar9mo ago
okay ill try it Still same error. The weird part is it worked perfect the first deploy. I had gcc and libpq-dev installed with the Nixpacks, and pyscop in the requirements. As soon as i redeployed it croaked
Brody
Brody9mo ago
first deploy, when?
salzar
salzar9mo ago
Like I basically started a new project by selecting my repo That first deploy worked no psycopg issues Then I redeployed the same code and it died wait a minute i just added both psycop-binary and psycop regular and its working now
Brody
Brody9mo ago
sweet, problem solved
salzar
salzar9mo ago
Thanks for all the help Im pretty curious as to why that helped it My theory is that theres an installation issue with libpq-dev thats still happening, and the binary version fills in whatever is missing from that, and then the regular psycop package is whats required by my python code I believe the purpse of the binary package is to avoid having to use seperatly install the binaries. But for now, im just gonna leave it and not screw with it lmfao
Brody
Brody9mo ago
thats exactly what i was thinking
salzar
salzar9mo ago
Because my first deploy it was able to detect the binaries from install the nixpacks env var that I set I assumed that there was some sort of package caching issue but I set that cache env var to 1 like you said earlier but it didnt do anything I'll have to look into it more, very strange but I feel like it might be a railway bug. I just started using railway today tho so I have no idea. Could be me
Brody
Brody9mo ago
i wouldnt say bug, just something that nixpacks should account for, your app isnt doing anything crazy advanced after all
salzar
salzar9mo ago
Ya its nothing wild just a server i built for open ai function calling, code interpreter basically But I appreciate your help, thank you
Brody
Brody9mo ago
no problem!