4 months ago
I have been unsuccessful in using the pyproject.toml to install remote deps (thus replacing the root requirements.txt file) via the uv package. But I'd be ok with using just the Dockerfile if possible. Can you give guidance please?
0 Replies
4 months ago
Hey @Niccolò, have you tried switching the builder to Railpack in your service's settings?
I do have a multistage Dockerfile with a remote stage which is not being picked up
Anyways, I'd actually be ok with using the Dockerfile since it's got a local stage anyways
but I don't know how to reference the remote stage for Railway to pick that one up instead of the local one
4 months ago
This is correct if you want to use Railpack. Alternatively, without renaming your Dockerfile, you can also add a railway.json at the root of your project with the following content to tell Railway to use Railpack as opposed to the detected Dockerfile.
{
"$schema": "https://railway.com/railway.schema.json",
"build": {
"builder": "RAILPACK"
}
}Ok, thanks. What about the Dockerfile issue? Any chance of having Railway pick up the "remote" stage specifically?
4 months ago
Can you show the Dockerfile?
4 months ago
If I am not mistaken, there is currently no way to specify a specific target in a multi stage Dockerfile, it is best to create a Dockerfile for this stage alone and overwrite the Dockerfile path to your new Dockerfile using a service variable.
For example if you create a new Dockerfile called Dockerfile.remote:
RAILWAY_DOCKERFILE_PATH=Dockerfile.remoteOk, as I think maintaining 2 Dockerfiles would be too error prone, I think I'll go with the other solution. I have a couple of questions about this.
How can I port my current Nixpacks config (which is installing gcc, postgresql and python 3.13) to the Railpack system?
How is Railway supposed to pick the "local" and "remote" dependency groups in the pyproject.toml?
Giving you more context. This is how the deployment is failing on me right now:
``v sync --locked --no-dev --no-install-project
process "uv sync --locked --no-dev --no-install-project" did not complete successfully: exit code: 2
error: No interpreter found for Python >=3.13 in managed installations or search path
hint: A managed Python download is available for Python >=3.13, but Python downloads are set to 'never'``
4 months ago
Is this using Nixpacks or Railpack?
4 months ago
Do you have a .python-version file? This technically isn't needed since Railpack should use 3.13.2 by default, but just in case you overwrote the version.
4 months ago
Railpack also checks for the Python version at other places, which may or may not have a version specified that isn't >= 3.13. https://railpack.com/languages/python/#versions
Ok, thank you, it went through the process of deploying, but now the app is crashing, I presume because it is not finding the postgresql package (which I used to be able to install with the Nixpackages approach). How do I do that with Railpacks?
` File "/app/.venv/lib/python3.13/site-packages/django/db/backends/postgresql/base.py", line 29, in
raise ImproperlyConfigured("Error loading psycopg2 or psycopg module")django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 or psycopg module
`
4 months ago
What was your Nixpacks approach? Also, can you try Nixpacks again, or is there a problem with Nixpacks (such as with uv)?
With the Nixpacks approach I was selecting the Nixpacks as the builder
but I had the requirements.txt, whereas now I have the pyproject.toml
If I should stay with Nixpacks, how is it supposed to pick the packages from the pyproject.toml?
I just tried with Nixpacks btw, but it is failing
[stage-0 3/10] COPY .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix failed to calculate checksum of ref ojxpv0ui1grqct03z03c8vd4l::j23jir1qces40cyctdg24dnn9: "/.nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix": not found
4 months ago
Nixpacks should also support pyproject.toml, at least per the docs. Now I am interested in why this is failing, do you mind trying out a different Postgres driver and Railpack? Not sure if anything has to do with this, but your pyproject.toml has pyscopg 3 specified https://pypi.org/project/psycopg2/.
I don't think that is the problem, that dependency used to be there before.
`✕ [stage-0 3/10] COPY .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix
failed to calculate checksum of ref wopnawjcyyxgr34vssu7xmlrp::tli9ohmvj7e9q5ua0s38sbtwr: "/.nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix": not found
Dockerfile:7
5 |
6 |
7 | >>> COPY .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix
8 | RUN nix-env -if .nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix && nix-collect-garbage -d
9 |
ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref wopnawjcyyxgr34vssu7xmlrp::tli9ohmvj7e9q5ua0s38sbtwr: "/.nixpacks/nixpkgs-bc8f8d1be58e8c8383e683a06e1e1e57893fff87.nix": not found
Error: Docker build failed`
4 months ago
I am kinda out of ideas at this point, I would try using the Dockerfile approach, while maintaining two separate can be error prone, it does at the end of the day give you total control over how your application is built.
-# I am going to sleep now, so expect answers to be delayed.
4 months ago
The implementation was getting a bit too vendor specific. I figured out what went wrong with the Railpack and fixed it (I just had to use the binary version of psycopg 3). Then, replacing the Railpack install command to target the remote dependenceis and changing all other commands to use uv rundid it.
4 months ago
At some point, especially with complex setups, it may just be easier to just write a Dockerfile. But in this case, I am glad that you have solved the issue with Railpack by modifying the commands to run. I'll mark this thread as solved if you don't have any further questions.
4 months ago
!s
Status changed to Solved uxuz • 4 months ago

