FastAPI working locally but not in railway
I have a fast api that uses opencv-python-headless and its giving me this error
Note: This project was already running before but after pushing another update in my Github Repository the deployment is crashing
45 Replies
Project ID:
d942101e-d604-463a-ae38-70e444e7cef0
d942101e-d604-463a-ae38-70e444e7cef0
use the headless version of open cv
I am already using the headless version of opencv
send requirements.txt please
https://stackoverflow.com/a/69125651
Try installing opencv-python-headless python dependency instead of opencv-python. That includes a precompiled binary wheel with no external dependencies (other than numpy), and is intended for headless environments like Docker. This saved almost 700mb in my docker image compared with using the python3-opencv Debian package (with all its dependencies).
here is my requirements.txt
are you actually using all those packages
yes I am using those packages
I have no problem with it before, but after updating pt files, and pushing changes the deployment is crashing
one of those packages might be installing the non headless version of open cv
ohh I didnt thought of that, let me check all the packages
this isn't the first time I've seen this question asked, and it's always been solved by using the headless versions
I think I have seen those questions, I have experienced it before and solved it by adding
opencv-python-headless
on the requirements.txt, I am now clueless on why it came back after a long timekeep looking!
I will thank you
For some reason this is showing up in the Build Logs
its installing the non headless opencv also
dig deeper
ultralytics is the one causing it to install the non headless version but Deployment Logs says that its a missing module what should I do
GitHub
Can opencv-python be switched to headless? · Issue #2179 · ultralyt...
Search before asking I have searched the YOLOv8 issues and discussions and found no similar questions. Question Hi, I have ultralytics as a dependancy, however during installation it auto installs ...
it shows in the build logs this
where can I edit this? or is this built in
as i said in the other thread, maybe the requirements.txt file can be edited to exclude that one dependency?
you can only indicate what to exclude on pip installations
https://github.com/ultralytics/ultralytics/issues/2179#issuecomment-1574878818 moving away from requiements.txt might resolve it
GitHub
Can opencv-python be switched to headless? · Issue #2179 · ultralyt...
Search before asking I have searched the YOLOv8 issues and discussions and found no similar questions. Question Hi, I have ultralytics as a dependancy, however during installation it auto installs ...
thats based on what I saw online
An option to solve this would be switching from the requirements.txt to setuptools, which allows you to provide groups of optional dependencies, so users would be able to install only what the need, for example ultralytics, ultralytics[dev] or ultralytics[dev,extras].oh that's for the lib not for you. 😦
As a potential workaround, you can try manually specifying each package and version in your requirements.txt file, without including any dependencies that you do not want. This will require some extra work on your end, but it should allow you to have greater control over which packages are installed. Alternatively, you can try installing Ultralytics YOLOv8 with the --no-deps flag in a separate step after installing all the other packages in your requirements.txt file. This should prevent OpenCV from being installed automatically. I hope this helps! Please let me know if you have any further questions or concerns.
thats what I am currently look it to edit the script during building/deployment
pip install $(grep -ivE "pkg1|pkg2|pkg3" requirements.txt)maybe put that into the custom build command in the settings with pkg1, 2, and 3 being the packages you wanna exclude
Stack Overflow
Pip install to custom target directory and exclude specific depende...
I'm looking for a method to use pip or similiar to install a list of python packages to a custom target directory (ex./mypath/python/pkgs/ ), but also exclude/blacklist specific dependencies.
I ...
I ...
the build command is located in railway.json correct?
I have tried using it here but its not running the script
i use it from the website itself
in settings
(excuse the win7 and lowres, my laptop broke lmao)
I dont see where I should put the script in the settings
in the build command?
yeah, i think so
let me try that
in the stackoverflow question
someone mentions that if that doesnt work you should try this:
pip freeze | grep -vFxf pip_ignore.txt > requirements.txtYou need to put the ignored packages in pip_ignore.txt
thank you for your help, I'll try those solutions and will get baack to you after
hope they work
I would like to thank you for everyone who helped me. Its now working. Thank you so much
awesome!
Let's go, was it the thing i told you?
Yes I placed the pip install on the build command, remove open cv and install the headless version
It can cause problems when both were installed at the same time so the headless version must be installed after deleting the non headless version
nice!
glad to know it works
how did you do this?
i'm having the same problem but it does not work on me