Problem installing dlib library in my railway environment

Project ID: 841bbdef-4033-4e74-953c-030beb316802 Project code: https://github.com/SeifShaat/Divine-Smile/tree/main I'm trying to install dlib in my railway environment because it's needed in my python script. dlib requires CMake to be installed first so I wrote CMake, dlib, numpy and opencv-python in a requirements.txt file and committed it but for some reason dlib doesnt install because it keeps saying that CMake has to be installed. Can anyone please help? Relevant log: #11 11.86 × Running setup.py install for dlib did not run successfully. #11 11.86 │ exit code: 1 #11 11.86 ╰─> [8 lines of output] #11 11.86 running install #11 11.86 running build #11 11.86 running build_py #11 11.86 package init file 'tools/python/dlib/__init__.py' not found (or not a regular file) #11 11.86 running build_ext #11 11.86 #11 11.86 ERROR: CMake must be installed to build dlib #11 11.86 #11 11.86 [end of output]
GitHub
GitHub - SeifShaat/Divine-Smile
Contribute to SeifShaat/Divine-Smile development by creating an account on GitHub.
37 Replies
Percy
Percy2y ago
Project ID: 841bbdef-4033-4e74-953c-030beb316802
Brody
Brody2y ago
can i ask why you had a railway.yaml file?
sshaat
sshaatOP2y ago
I've tried a couple of things using chatgpt and railway.yaml was one of his answers
Brody
Brody2y ago
i thought so full build logs please in .txt format if you could
sshaat
sshaatOP2y ago
sure 1 sec
sshaat
sshaatOP2y ago
sshaat
sshaatOP2y ago
I just started using railway today for the first time, so it's a bit hard for me to grasp
Brody
Brody2y ago
[phases.setup]
nixPkgs = ["...", "cmake"]
[phases.setup]
nixPkgs = ["...", "cmake"]
this is untested, but try adding that as a nixpacks.toml file in your project
sshaat
sshaatOP2y ago
okay I'll try, 1 sec returned a new error, want me to send over the full logs?
Brody
Brody2y ago
yes please
sshaat
sshaatOP2y ago
Brody
Brody2y ago
[phases.setup]
nixPkgs = ["...", "cmake"]
aptPkgs = ["...", "libcrypt-dev"]
[phases.setup]
nixPkgs = ["...", "cmake"]
aptPkgs = ["...", "libcrypt-dev"]
try this
sshaat
sshaatOP2y ago
sure 1 sec still getting errors
sshaat
sshaatOP2y ago
here's the log
sshaat
sshaatOP2y ago
@Brody still there?
Brody
Brody2y ago
I'm making dinner actually, but if you give me some minimal reproducible code I will give it another crack later tonight
sshaat
sshaatOP2y ago
sorry, what exactly do you mean by minimal reproducible code?
sshaat
sshaatOP2y ago
whenever you're free, you can check out my repository, it includes my code 'main.py' and the other 2 files referenced in the 'main.py' and the requirements.txt file which is the file that has the main problem I think. 'mainpy' is a 63 line code basically a minimal code and its fully commented in each line to clarify what exactly it's supposed to do. keep in mind that the problem im facing isnt in the main code for now but rather in the imported libraries that's used in the code (1 library to be exact 'dlib'). would that be okay?
Brody
Brody2y ago
please read over this, your repo is not what this guide would call minimal. there's not much else I can do at this point without a minimal example to do tests with
sshaat
sshaatOP2y ago
The problem isn't in the code. the problem is that railway doesn't execute the pip command to install the requirements.txt successfully. the code itself is irrelevant to the problem except for the part where I import those packages, everything else in the code doesn't come into play when trying to solve this error. Basically the problem is in the requirements.txt once that problem is fixed it's done. would you like me to send over the requirements.txt file?
Brody
Brody2y ago
i know your code is irrelevant, I'm just asking for you to make this just a tad easier for me, because as it stands, I'd have to download a repo with a 100mb file in it if you could provide me with a repo, that excludes this file, that would be great
sshaat
sshaatOP2y ago
I wanna make things easier for you. And thank you by the way for helping me so far I really appreciate it. I'm a bit new to programming. I'm currently a student so this is a bit hard for me.
Brody
Brody2y ago
so I'd just like a repo with the minimal amount of files/code that still produces the same build error as your full repo
sshaat
sshaatOP2y ago
Okay 1 sec I'll give it a try
Brody
Brody2y ago
okay but I'm only able to chat because I'm on my phone right now, I won't be able to do any tests until later tonight, so that gives you plenty of time
sshaat
sshaatOP2y ago
https://github.com/SeifShaat/Divine-Smile/tree/main check this repo. it doesnt have any big files just the main code and the requirements.txt and the nixpacks.toml file you told me to create. would that be okay?
GitHub
GitHub - SeifShaat/Divine-Smile
Contribute to SeifShaat/Divine-Smile development by creating an account on GitHub.
Brody
Brody2y ago
yep that's what I'm talking about, thank you I will get back to this later!
sshaat
sshaatOP2y ago
Okay, take your time. Thanks in advance
Brody
Brody2y ago
@SShaat - turns out it wasn't too complicated after all. 1. delete the nixpacks.toml file 2. replace your requirements.txt with this
flask==2.3.2
opencv-python-headless==4.7.0.72
numpy==1.24.3
dlib-binary==19.24.1
gunicorn==20.1.0
flask==2.3.2
opencv-python-headless==4.7.0.72
numpy==1.24.3
dlib-binary==19.24.1
gunicorn==20.1.0
3. add a .python-version with this in it
3.10
3.10
4. add a Procfile with this in it
web: gunicorn main:app
web: gunicorn main:app
5. make sure you don't have a build or start command defined in the railway service settings with these changes, that minimal repo does build
sshaat
sshaatOP2y ago
sorry is the .python-version a file named like that?
Brody
Brody2y ago
that's correct, that's the name of the file
sshaat
sshaatOP2y ago
okay I'll try Thank you so much. It worked. I pushed my original files back and it deployed and working. Thanks again mind if I ask here if I run into any problem?
Brody
Brody2y ago
awesome, glad I could help! of course, as long as the questions relate to railway in some way
sshaat
sshaatOP2y ago
yea ofc. Thanks again.
sshaat
sshaatOP2y ago
hey @Brody, I started using railway because I wanted to push a flask python script to host it on railway to be able to use it in my flutter app. The python script uses opencv and dlib to process facial features specifically to measure the distance between both eyebrows and the nose tip. I set up a camera system in my flutter app but have trouble sending the frames captured by the flutter camera to the python script to be processed and back to flutter to display. Can you help me with that? Thanks in advance
Brody
Brody2y ago
I might be able to, what seems to be the problem
Want results from more Discord servers?
Add your server