problems when trying to install a requirements.txt in a nodejs and python project
I was trying to use chatgpt to help with this being my docker file:
but this is railways error:
ERROR: failed to solve: process "/bin/sh -c pip3 install --no-cache-dir -r requirements.txt" did not complete successfully: exit code: 1
182 Replies
Project ID:
33299ddc-4953-43ff-a20d-cc4da4713125
33299ddc-4953-43ff-a20d-cc4da4713125
full build logs please https://bookmarklets.up.railway.app/log-downloader/
i tried doing what it said here but i got the same type of error:
To install Python packages system-wide, try apt install #12 0.740 python3-xyz, where xyz is the package you are trying to #12 0.740 install.@Brody any updates? sorry if im rushing
currently working on another users help thread, will circle back to this when thats done! just needed to get the build logs out of the way
no worries thanks for the reply
i dont have much time today but ill reply tomorrow
i saw one of your old threads on this topic so im trying the nixpacks.toml method
dang your fast
i can click an emoji but i dont quite have the time to dig into this right now, sorry
oh no worries it worked i think
oh yeah?
well it deployed
im testing the api
lets see the nixpacks.toml file
https://www.answeroverflow.com/m/1139695424924557433
[phases.setup]
nixPkgs = ["...", "python3"]
How to install python3 on railway server for Node.js project - Railway
I'm running a python script in my node js API and it works locally but i don't think python3 is installed on my railway server and i'm getting errors, how do i fix this?
i just got the error that the package lief is not found i just gotta install it
which ill search up shortly
system package? python package?
python package
missing from your req.txt?
i have it there i just dont know how to actually get the project to install from it
It doesn’t seem like it’s getting detected in my project
send the build logs please
I added it to the railway config in settings to but nothing
Alright one second
thems the deploy logs
still the deploy logs
build logs please
Oh woops sorry
Alright
oh youre still using the dockerfile
Yup
you dont want to use nixpacks?
I could I just didn’t think of it
If I need to switch over I can
you started looking into nixpacks, did you pivot back to the dockerfile?
Nope I just didn’t know I couldn’t have two
I was a little confused but I’m starting to get the idea now
yeah they are multiply exclusive, needs to be one or the other
Oh okay
I’ll just post my dockerfile here for now
wrap that in triple backticks please
ah mobile sucks
Yeah I will one sec
Fixed
Should I replicate that dockerfile in a nixpacks file?
not yet
but that script uses sudo, so its not really fit to be run in a docker environment
true yeah
So what should I do at this point now?
what is pyzule?
It’s a python project on GitHub to inject tweaks into iOS application files
GitHub
GitHub - asdfzxcvbn/pyzule: an azule "clone" written in python3
an azule "clone" written in python3. Contribute to asdfzxcvbn/pyzule development by creating an account on GitHub.
⬆️
you would need a way to install that in a docker environment, likely simply removing sudo will do
I already have all the project files in the GitHub for it
Like it works locally
I just gotta install the python packages to use it
But yeah ill use nixpacks because a dockerfile sucks
I can’t get it to work
sounds good!!
I’m using nixpacks now but:
ERROR: failed to solve: process "/bin/bash -ol pipefail -c pip install -r requirements.txt" did not complete successfully: exit code: 127
build logs please
Sure
It might be the file path though one sec
heres the nixpacks file:
you dont want to specify nodejs, replace that with
...
alright
add
python311Packages.pip
to the nixPkgs arrayAlright
have you tried researching
error: externally-managed-environment
?I haven’t but I definitely will now
I’d have to use a venv wouldn’t I?
that sounds like something that could work
I’ll try
I got it to get to a better point
awesome!
I still get this error: ERROR: failed to solve: process "/bin/bash -ol pipefail -c pip install -r requirements.txt" did not complete successfully: exit code: 127
But when running an ls command
11 0.283 index.js
#11 0.283 nixpacks.toml
#11 0.283 package-lock.json
#11 0.283 package.json
#11 0.283 pyzule
#11 0.283 requirements.txt
#11 DONE 0.3s
that's just a message telling you there was an error, that alone doesn't do either me or you any good, we'd need to look at the full logs
nixpacks toml please
[phases.setup]
nixPkgs = ['nodejs', 'python3', 'git']
aptPkgs = ['build-essential', 'python3-venv']
[phases.install]
cmds = ['ls', 'python3 -m venv /opt/venv', 'source /opt/venv/bin/activate', 'npm install', 'chmod +x ./pyzule/install-pyzule.sh', 'pip install -r requirements.txt', './pyzule/install-pyzule.sh']
[phases.build]
cmds = ['chmod +x ./pyzule/pyzule.py']
[start]
cmd = 'source /opt/venv/bin/activate && node index.js'
I’m on mobile so I can’t tick it
^
Woops I forgot
^
Gpt removed that stuff sorry one sec
gpt 😐
sorry lmao I’m still learning
I am searching online though
gpt doesn't know anything about a nixpacks.toml file though, using it is doing more harm than good tbh
I’m using gpt 4 so it has browsing to search it up but yeah
none of what we are doing is really documented anywhere
it's guessing
True
but this kind of stuff not being documented is not ideal either
Yup
Ill have to reply tomorrow since I gotta sleep but thank you so much for your help I would have been dead without your help here
happy to help where I can
I’ll just say now the error for requirements.txt is saying error code 1 instead of 178 but I’ll send logs tomorrow
haha I think 1 is better than 178
lol yeah but it’s still an annoying error none the less. but does that mean it’s finding the file at least?
no clue, like I said, it's just the message telling us that there was an error during build, for the actual error you'd need to look into the logs
Got it
@Brody
heres a new one with pip3
well I think it's time to go back to a Dockerfile!
nix is being difficult
lmao alright. What should I do to my dockerfile from above to make it work?
also if you reply please ping me
start from a base alpine image, and install python, pip, node, and npm via apk
How do I start as that on railway?
sorry im not sure i understand the question
Like railway will automatically install npm because it’s a JavaScript project how can I make it start with nothing
And do it all manually just as you said
install python, pip, node, and npm via apk
Alright
ok im gonna test a new one rk
i cannot get anything to work
ill send a log and what i have for dockerfile
ive been using a mix of gpt and searching online but havent got really anywhere
first question, doesnt install-pyzule.sh use sudo?
i would suppose so yes..
thats still not going to work
oh?
not that its your current issue, but sudo is not to be used in a docker environment
oh so what should i be doing?
well first lets just atleast get the requirements.txt to install
just not using sudo, the script is already ran as root
oohh
ok
one sec
fixed
but yes, looking at logs now
remove the venv stuff, not sure why nixpacks uses it, but I don't think you have to
got it
latest error for the code above
This environment is externally managed
bruh
pip, i assure you, its not is so stupid lol
alright put the venv stuff back
alright
testing
ok so its detecting my packages and installing them from requirements.txt which is nice
maybe replace cmake with make?
got it
i must have to use cmake:
RuntimeError: CMake must be installed to build the following extensions: lief 5.320 [end of output]
then install both cmake and make
got it
i assume you need lief?
but the requirements.txt installs it
do you need it
or is it a 3rd party module?
3rd party module
do you need the module that installs it?
maybe
let me try without running the sh file
and just installing lief directly
can you check?
i didnt make pyzule have no idea
the problem was when i was running pyzule it said this
fair enough
wait:
on debian-based systems (like ubuntu), run the following:
on arch based systems, use:
install pyzule:
could I do that?
its pyzules documentation
you arent on a debian-based docker image, you're using alpine right now
im saying for railway
i was testing pyzule locally on a mac
you are using an alpine image in your dockerfile
so i would run the arch instructions correct
you cant run apt commands on alpine, alpine uses apk
try adding
python3-dev
to the apk packages@Brody i think i know what the problem is now. in the log theres spots saying command not found and this script tries to install lief but i think i have to modify it to work:
https://pastebin.com/U5JadkgN
Pastebin
#!/bin/bashOS=$(uname)ARCH=$(uname -m)PZ_DIR=${HOME}/.config/pyzule...
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.
specifically this line here:
and other packages like unzip
did you skip installing modules from the requirements.txt file?
i removed that now that i see the sh install is suppose to do it
you got one strange app
lmao yup...
still cant use sudo though
yeah
just simply remove the word sudo
the script is already ran as root, the whole build context is
aight
building
add curl to the apk install list
and unzip too
Yup those fixed the command not found errors now it’s just the lief error
I’m gonna try manual installing now that the other errors are fixed
Sadly is didn’t work
But I’ll send the life
Logs*
i have no clue what to make of that error
time to try a debian image in your dockerfile instead
Alright, here’s the main broken log parts
What should I do to switch to Debian
Atleast then we can install based on the documentation steps
rewrite your dockerfile but use a debian image instead of alpine
ok
Should I add back sudo?
nope
Ok
Well Leif installed!
It’s just deploying now
that was a fast rewrite
I used gpt :skully:
But searched a few things to
Now I need a PIL module
Time to install that
It takes almost 4 minutes to build and deploy with Debian now
Which kinda sucks but is meh
well you are installing a lot of stuff
true
I’m getting this error for pil now:
3.656 ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
3.656 ERROR: No matching distribution found for PIL
-----
Should I do a specific version?
prob doesnt like the python version you have installed
Oh wait
Most likely yeah
What python version should I install you think
Because right now it’s just installing latest
whatever version PIL supports
I’m finding things online about pillow which is a form of it since I can’t find anything about pil
I’ll try installing that
Then try version changing
Ok it built
Time to test
I’m getting somewhere there’s no package errors
Just my code errors
CMON PLEASE
WORK
so close
It’s deploying now with updated code
Almost
It’s active now I just gotta wait for it to respond online
IT WORKED
LETS GOOO
yoooo
lets see the dockerfile
THANK YOU SO MUCH
aight one sec lmao
tiny improvements
I just want to say one more time thank you for everything and wasting your time to help me with a very very odd project.
It’s also crazy that unzipping a 100mb file and storing it only took 11mb of ram
no time spent in #help is time wasted
lol well this was longer than usually but thank you. Does this stay here because I will definitely need this later on?
I used it before but it was for a simpler thing I think I remembered you helped before a few months back
yeah this stays here
Last thing does anything break if I accidentally have sudo in a command or will it work as normal
sudo does not work in a docker environment
if you need to run this script locally, run the entire script with sudo
:thumbsup:
@Brody I feel like my project will get very expensive just with whats its doing. do you any places where I could either get it for extremely cheap or buy a deticated server?
sorry i only shill railway
okay