Problem installing dlib library in my railway environment

SSShaat5/21/2023
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]
Bbrody5/21/2023
can i ask why you had a railway.yaml file?
SSShaat5/21/2023
I've tried a couple of things using chatgpt and railway.yaml was one of his answers
Bbrody5/21/2023
i thought so
Bbrody5/21/2023
full build logs please
Bbrody5/21/2023
in .txt format if you could
SSShaat5/21/2023
sure 1 sec
SSShaat5/21/2023
SSShaat5/21/2023
I just started using railway today for the first time, so it's a bit hard for me to grasp
Bbrody5/21/2023
[phases.setup]
nixPkgs = ["...", "cmake"]
Bbrody5/21/2023
this is untested, but try adding that as a nixpacks.toml file in your project
SSShaat5/21/2023
okay I'll try, 1 sec
SSShaat5/21/2023
returned a new error, want me to send over the full logs?
Bbrody5/21/2023
yes please
SSShaat5/21/2023
Bbrody5/21/2023
[phases.setup]
nixPkgs = ["...", "cmake"]
aptPkgs = ["...", "libcrypt-dev"]
Bbrody5/21/2023
try this
SSShaat5/21/2023
sure 1 sec
SSShaat5/21/2023
still getting errors
SSShaat5/21/2023
here's the log
SSShaat5/21/2023
@Brody still there?
Bbrody5/22/2023
I'm making dinner actually, but if you give me some minimal reproducible code I will give it another crack later tonight
SSShaat5/22/2023
sorry, what exactly do you mean by minimal reproducible code?
SSShaat5/22/2023
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?
Bbrody5/22/2023
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
SSShaat5/22/2023
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.
SSShaat5/22/2023
would you like me to send over the requirements.txt file?
Bbrody5/22/2023
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
Bbrody5/22/2023
if you could provide me with a repo, that excludes this file, that would be great
SSShaat5/22/2023
I wanna make things easier for you. And thank you by the way for helping me so far I really appreciate it.
SSShaat5/22/2023
I'm a bit new to programming. I'm currently a student so this is a bit hard for me.
Bbrody5/22/2023
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
SSShaat5/22/2023
Okay 1 sec I'll give it a try
Bbrody5/22/2023
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
SSShaat5/22/2023
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?
Bbrody5/22/2023
yep that's what I'm talking about, thank you
Bbrody5/22/2023
I will get back to this later!
SSShaat5/22/2023
Okay, take your time.
SSShaat5/22/2023
Thanks in advance
Bbrody5/22/2023
@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

3. add a .python-version with this in it
3.10

4. add a Procfile with this in it
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
SSShaat5/22/2023
sorry is the .python-version a file named like that?
Bbrody5/22/2023
that's correct, that's the name of the file
SSShaat5/22/2023
okay I'll try
SSShaat5/22/2023
Thank you so much. It worked. I pushed my original files back and it deployed and working. Thanks again
SSShaat5/22/2023
mind if I ask here if I run into any problem?
Bbrody5/22/2023
awesome, glad I could help!
Bbrody5/22/2023
of course, as long as the questions relate to railway in some way
SSShaat5/22/2023
yea ofc. Thanks again.
SSShaat5/22/2023
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
Bbrody5/22/2023
I might be able to, what seems to be the problem