R
Railway5mo ago
Kurdiez

Python dependencies installed but not copied due to `Text file busy: '/opt/venv/bin/python'`

I just created a new Python service to test so it is very light weight. In the service's Settings > Custom Build Command I have pip install -r requirements.txt which I think is pretty standard. However I am seeing the following in the build log and failing. Installation of the dependencies all complete properly, it's just the step after that is failing.
No description
Solution:
It looks like you are using nixpacks? Why do you have custom build command? NIxpacks should find the requirements file and instal for you. Can you send the top of the logs? So I can see what the different build steps are?
Jump to solution
15 Replies
Percy
Percy5mo ago
Project ID: 9e3c9670-2007-40d3-b956-558ed96af87a
Kurdiez
KurdiezOP5mo ago
9e3c9670-2007-40d3-b956-558ed96af87a
Solution
Joshie
Joshie5mo ago
It looks like you are using nixpacks? Why do you have custom build command? NIxpacks should find the requirements file and instal for you. Can you send the top of the logs? So I can see what the different build steps are?
Kurdiez
KurdiezOP5mo ago
I don't know what NIXPACKS is. I just removed my own pip install custom build command. Now re-running it and the log shows this so far
╔══════════════════════════════ Nixpacks v1.24.0 ══════════════════════════════╗

║ setup │ python3, postgresql, gcc ║

║──────────────────────────────────────────────────────────────────────────────║

║ install │ python -m venv --copies /opt/venv && . /opt/venv/bin/activate ║

║ │ && pip install -r requirements.txt ║

║──────────────────────────────────────────────────────────────────────────────║

║ start │ airflow standalone ║

╚══════════════════════════════════════════════════════════════════════════════╝





#0 building with "default" instance using docker driver



#1 [internal] load build definition from Dockerfile

#1 transferring dockerfile: 2.63kB done

#1 DONE 0.0s

#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1716249803

#2 DONE 0.1s

#3 [stage-0 1/11] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1716249803@sha256:5ef4d2021c418fcaabb56cea5ea9e24a5fdedfe27f58062d9689214dfed45c46

#3 DONE 0.0s

#4 [internal] load .dockerignore

#4 transferring context: 2B done

#4 DONE 0.0s

#5 [internal] load build context

#5 transferring context: 95.64kB done

#5 DONE 0.0s

#6 [stage-0 2/11] WORKDIR /app/

#6 CACHED

#7 [stage-0 3/8] COPY .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix

#7 CACHED

#8 [stage-0 4/8] RUN nix-env -if .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix && nix-collect-garbage -d

#8 CACHED

#9 [stage-0 5/8] COPY . /app/.

#9 DONE 0.1s

#10 [stage-0 6/8] RUN --mount=type=cache,id=s/b87af275-e564-464a-bd7b-b7bebf5c8fda-/root/cache/pip,target=/root/.cache/pip python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt
╔══════════════════════════════ Nixpacks v1.24.0 ══════════════════════════════╗

║ setup │ python3, postgresql, gcc ║

║──────────────────────────────────────────────────────────────────────────────║

║ install │ python -m venv --copies /opt/venv && . /opt/venv/bin/activate ║

║ │ && pip install -r requirements.txt ║

║──────────────────────────────────────────────────────────────────────────────║

║ start │ airflow standalone ║

╚══════════════════════════════════════════════════════════════════════════════╝





#0 building with "default" instance using docker driver



#1 [internal] load build definition from Dockerfile

#1 transferring dockerfile: 2.63kB done

#1 DONE 0.0s

#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1716249803

#2 DONE 0.1s

#3 [stage-0 1/11] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1716249803@sha256:5ef4d2021c418fcaabb56cea5ea9e24a5fdedfe27f58062d9689214dfed45c46

#3 DONE 0.0s

#4 [internal] load .dockerignore

#4 transferring context: 2B done

#4 DONE 0.0s

#5 [internal] load build context

#5 transferring context: 95.64kB done

#5 DONE 0.0s

#6 [stage-0 2/11] WORKDIR /app/

#6 CACHED

#7 [stage-0 3/8] COPY .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix

#7 CACHED

#8 [stage-0 4/8] RUN nix-env -if .nixpacks/nixpkgs-bf446f08bff6814b569265bef8374cfdd3d8f0e0.nix && nix-collect-garbage -d

#8 CACHED

#9 [stage-0 5/8] COPY . /app/.

#9 DONE 0.1s

#10 [stage-0 6/8] RUN --mount=type=cache,id=s/b87af275-e564-464a-bd7b-b7bebf5c8fda-/root/cache/pip,target=/root/.cache/pip python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt
Ok, the build is succsesfully finished
Joshie
Joshie5mo ago
Yea. The pip install is part of install and not really "build". But see the top of the log? Where it says Nixpacks v1.24.0. Railway uses that as the default builder.
Adam
Adam5mo ago
Nixpacks is Railway’s automatic builder, it handles most builds for you. You should only be using custom commands or a dockerfile if it’s not working or you need more customization
Kurdiez
KurdiezOP5mo ago
However, the build is working fine but the deployment isn't. I want to access the webserver using HTTPS so I configured the web server to use 443 port and I can see that it was started with 0.0.0.0:443. However with the public domain, I can't access the server. Am I doing something wrong? Seeing as Railway dockerizes my code and deploys it, I am not sure what port I need to bind to from my server to get exposed to 443 correctly.
Kurdiez
KurdiezOP5mo ago
Ok, I just added my own PORT env variable in Railway with specific port my webserver binds to and it worked!
Joshie
Joshie5mo ago
Yay :party_cat:
Kurdiez
KurdiezOP5mo ago
Auto magic. Thanks for all the help
Brody
Brody4mo ago
why link the reverse proxy? 😆
Joshie
Joshie4mo ago
Idk his setup. And the part about ports with something like gunicorn, is useful. Just trying to account for any edge cases in setup.
Brody
Brody4mo ago
best to stick to the fixing common errors page
Joshie
Joshie4mo ago
Yea. I grabbed it after. Should have just linked it and if it didn’t work, link the other stuff. Well,,, ask more qualifying questions
Want results from more Discord servers?
Add your server