pyzbar library
Hi, I'm trying to deploy my code which uses the pyzbar library, but upon deployment, it errors, saying
ImportError: Unable to find zbar shared library
. I've researched this error, and apparently I need to install the packages libzbar-dev libzbar0
. I tried to do this with the startCommand in railway.json but it just doesn't work? I then saw this forum post (https://www.answeroverflow.com/m/1051264145758093362) but it wasn't very helpful, as I'm new to using Nix.
Any help would be greatly appreciated, thank you.Solution:Jump to solution
hey @x finally back at my computer after being out all day, got the example app working with a Dockerfile and i have made a PR to the repo.
PR here https://github.com/1x6/pyzbar-error/pull/1
working example app here https://zbar.up.railway.app/
the Dockerfile in the PR works for the example app, but it may be missing some other things that your actual app may need, but start by applying everything i did in the PR to your actual repo, such as deleteing the Procfile and Nixpacks.toml and making the changes to the railway.json file.
if the Dockerfile provided creates new errors i would be happy to work through them too....
26 Replies
Project ID:
52094dae-9587-400c-9449-0c0ac30d2014
52094dae-9587-400c-9449-0c0ac30d2014
startCommand in railway.json
"startCommand": "sudo apt-get update && sudo apt-get install libzbar-dev libzbar0 zbar-tools -y && python3 main.py",
deploy logs
can you provide a minimal reproducible example
yep
GitHub
GitHub - 1x6/pyzbar-error
Contribute to 1x6/pyzbar-error development by creating an account on GitHub.
deploy this and it should reproduce the error
please remove the apt commands from the start command, you never want to to install packages like that during runtime
oh okay, how would you suggest i do it please
the link you provided in your original post does contain a link to the docs page that does show you how to install apt packages during build, not that it would automatically fix it, but that would be at least the correct way to install packages
when I'm back at my computer in several hours I will try to get your example working, in the mean time, please do remove the apt commands from the start command
i see, thank you. i'll try use that
much appreciated, will do
i've removed the apt commands from the startcommand and put them in nixpacks.toml like this
altho it still says ImportError: Unable to find zbar shared library
like 80% of the way there, but I doubt it's going to work anyway, while installing apt packages in the start command is something you should never do, it would technically work, so if it didn't actually work, then it's not going to work installing them during build either
turns out I won't be able to get on my computer for another while since I now have to leave the house after waking up, try this nixpacks.toml file that I have not validated to work -
thanks for this, unfortunately it still does not work but i very much appreciate your help
thats a fair point ðŸ˜
are you testing with your minimal example too?
yeah i've been working on the minimal one all this time
are you familiar with Dockerfiles?
sadly not 😕
that's what I was gonna write for you
i've heard of them but i've never used docker so yeah :l
thank u tho
I have never used docker either, I've only wrote dockerfiles
do u think a dockerfile might make it work
I do
but I'm quite far away from my computer right now
its fine, thank you for ur help so far
let me know when u have time please
will do
Solution
hey @x finally back at my computer after being out all day, got the example app working with a Dockerfile and i have made a PR to the repo.
PR here https://github.com/1x6/pyzbar-error/pull/1
working example app here https://zbar.up.railway.app/
the Dockerfile in the PR works for the example app, but it may be missing some other things that your actual app may need, but start by applying everything i did in the PR to your actual repo, such as deleteing the Procfile and Nixpacks.toml and making the changes to the railway.json file.
if the Dockerfile provided creates new errors i would be happy to work through them too.
hey brody, thank you very much for taking your time to help me with this, ive merged the pr and will work on making it work with the actual repo. sorry for my late reply, but yeah thank you so much. ill update you and let you know if it all goes well.
sounds good!