How does python work in railway?
I'm trying to just install all the packages from my requirements.txt file but i cant seem to get it to work in railway? Is python preinstalled?
this is my code in the dockerfile currently:
Solution:Jump to solution
It was definitely the need for a venv thank you for the help. For anyone else who may somehow encounter this problem heres my docker file with the implemented fixes: https://pastebin.com/MeUwFBz7
Pastebin
Use Alpine Linux as the base imageFROM alpine:latest# Set an envi...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
53 Replies
Project ID:
24fb8332-eced-45f2-9c1b-a744e18df2ec
24fb8332-eced-45f2-9c1b-a744e18df2ec
ive been using chatgpt to help but cant find a quick solution
What Railway does is if it detects a
requirements.txt
file, it'll assume you're running a python project and spin up a Dockerfile based on that information ( you can of course write your own Dockerfile though, If you do, I think you'd need to install a python image in the Dockerfile )Thanks for the speedy reply! Heres my current docker file. I will try removing all python references to see if it does this automatically:
alright it definitely is deploying now without python references
🤔 oh
You're using node?
so are you using both python and nodejs then?
it won't install anything automatically if you have a Dockerfile
oh yes i am forgot to say it
i have some specific things that need python so im using sub proccesses in node js
You can get railway to give you both providers ( python and nodejs ) by adding a
nixpacks.toml
file in your project
you can then specify the providers, like so:
more info on that here: https://nixpacks.com/docs/configuration/file
alternatively there should also be a GUI option in your service settings under the Builds
tab but that setting is missing for meits on my end over here
yea nah it's not there
I'm talking about this
ohhh
yeah i dont seem to have that
yea, I made a feedback post about it, hope they'll add it back at some point
in the meantime you can do what i suggested earlier with the
nixpacks.toml
filealrighty!
testing now
just gonna note this here:
fragly build providers aren't applicable at all when using a dockerfile
that's a nixpacks thing, when using a dockerfile nixpacks isn't involved in anyway shape or form
ahh
Makes sense, my bad
so i should delete the nixpacks.toml file?
yea, my bad
It'd work normally but when you have a dockerfile then it won't do any of that for you
which I literally mentioned
I just forgor
what are we trying to do here, give me a tl;dr
Wants Python and Node in their project
with a dockerfile
aiming to just install some packages from my requirements.txt file currently
what's node used for and what's python used for?
node is used for my api server and python is used for some apple certificate validation
im running the python file through a node js sub process
@Brody
well I'm pretty sure apk has a python and pip package too, so just install it
must be doing something wrong
ERROR: failed to solve: process "/bin/sh -c python3 -m ensurepip" did not complete successfully: exit code: 1
but what was the actual error
it would be further up in the logs
and it doesn't look like you installed pip?
woops yup just noticed one sec
Pastebin
=========================Using Detected Dockerfile=================...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it definitely isnt based on that error
I did note this and I don't know if its required:
@Brody
that error wouldn't be related to railway so please try to research the error as I'm not a python dev
alright
You shouldn't need any of this, Railway should auto detect that you're running a python app, automatically install your requirements.txt and you'll be good to go
I don't see a reason why you need to use a Dockerfile here, Nixpacks should be able to do all that work for you
they also want node in the build, and are doing something with git during build, I think a dockerfile is fine for this usecase
i wouldnt technically need it but im installing a seperate package from git as said above:
Ah got it, I thought that was your repo, my mistake
oh alright
i tried removing all the python references inside my dockerfile and it build and deployed but it has cryptography cannot be found when in fact it was in my requirements.txt file
it used to work just not anymore and i cant figure out why
removing?
yeah
let's see your current dockerfile
are you including your venv in your repo?
i dont have an env file but are these the same?
not quite what I asked lol
Lmao well I don’t exactly know what a venv is
Google 😉
Alrighty
Ooh I see
But no I don’t have one
gotcha, well wouldn't hurt to Google this error too
that's all I would do
alright I definitely will. Thanks I’ll get back to you soon if it doesn’t work
Solution
It was definitely the need for a venv thank you for the help. For anyone else who may somehow encounter this problem heres my docker file with the implemented fixes: https://pastebin.com/MeUwFBz7
Pastebin
Use Alpine Linux as the base imageFROM alpine:latest# Set an envi...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
glad you where able to solve this!