Reputation: 1508
I have a Django application which uses zbar for barcode recognition. It works fine on my developer machine but when i tried to deploy it to Heroku my commit was rejected with the following message:
Installing collected packages: zbar
Running setup.py install for zbar
building 'zbar' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c zbarmodule.c -o build/temp.linux-x86_64-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
zbarmodule.h:26:18: error: zbar.h: No such file or directory
In file included from zbarmodule.c:24:
/*many "undeclared" errors*/
! Push rejected, failed to compile Python app
pip install zbar
works fine on my computer.
And i filled requirements.txt
cat requirements.txt
Django==1.5.5
PIL==1.1.7
dj-database-url==0.2.2
dj-static==0.0.5
django-toolbelt==0.0.1
gunicorn==18.0
psycopg2==2.5.1
static==0.4
wsgiref==0.1.2
zbar==0.10
Can anyone help me? PS Sorry for my writing mistakes. English in not my native language.
Upvotes: 2
Views: 1741
Reputation: 435
Check this way:
from pyzbar.pyzbar import decode
main: python app.py
pyzbar==0.1.8
libzbar-dev
https://github.com/heroku/heroku-buildpack-apt.git
heroku/python
source: https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637
Upvotes: 3
Reputation: 426
the zbar python package is just a wrapper.
You need to use heroku buildpacks. https://elements.heroku.com/buildpacks/generalui/heroku-buildpack-zbar this buildpack will install zbar on build
alternatively, you can also use this: https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt
and then include file called Aptfile
in the root of your project
libzbar-dev
it will install libzbar-dev
using apt-get
so when pip install zbar
runs, zbar will exist.
edit: include apt-get method
Upvotes: 2