last day (14 days later) » 

3:38 PM
2
A: How to install Python bindings originating from an apt package?

Padraic Cunninghamsudo apt-get install libzbar-dev sudo pip install zbar It is usually a -dev package that you are missing when you get those kind of errors, an easy way to find the package is apt-cache search like below: ~$ apt-cache search zbar libbarcode-zbar-perl - bar code scanner and decoder (Perl bindin...

 
Thanks a million! Just a note about your last line: apt-getting python-qrtools IS EQUAL TO apt-getting zbar-tools, libzbar-dev and python-zbar. So the last three replace the first one. But again; thanks a million!
 
@kramer65,no worries, did you not have python-qrtools installed already? I had to install libzbar-dev to remove the error.
 
Yes I did have python-qrtools already installed, but I just fired up a couple VMs to try it out on fresh installs.. :). Right now I'm trying to install this on heroku using the heroku-buildpack-apt, at which I fail miserably. I don't want to spam you, but if you also have an idea for my new question I would be extremely grateful: stackoverflow.com/questions/27425981/…
 
looking at your logs I don't think python-rtools install libzbar-dev, so libzbar-dev is needed in both cases, do you have a zbar.so file in yor site-packages?
 
But if I only install python-qrtools, running import zbar from the python command line does work. So I guess libzbar-dev doesn't seem to be needed..
 
3:38 PM
have you checked for the zbar.so?
I am using ubuntu 14.04, without installing libzbar-dev I cannot compile zbar with pip, python-rtools installs the zbar bindings only not the developement headers
I would search for the zbar.so and make sure it is in the path for the interpreter you are using, if not adding the path or copying the .so will work
I definitely needed to install the dev package, pip would not compile the package otherwise, complaining over the missing header
 
Thanks for the suggestion, I will try that in a moment.
But just a question:
so after doing sudo apt-get install python-qrtools you cannot import zbar from the python command line?
 
no, I have to install the dev headers and then install zbar using pip
if you run find /usr -type f -name "zbar.so" do you get any hits?
 
weird, because with a fresh 14.04 install and just updating, upgrading and installing python-qrtools I can actually import zbar in python
but let me search for zbar.so then
 
makes sense to me that it should not work as I imagine you are only installing the python bindings not an actual package that can be imported.
 
yeah, I don't understand it either..
well, I just found the following files on heroku:
/app/.apt/usr/lib/python2.7/dist-packages/zbar.so
/app/.apt/usr/lib/pyshared/python2.7/zbar.so
 
3:46 PM
ok, when you run an interpreter what does import sys sys.path output?
 
['', '/app/.heroku/python/lib/python2.7/site-packages/setuptools-5.4.1-py2.7.egg', '/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg', '/app', '/app/.heroku/python/lib/python27.zip', '/app/.heroku/python/lib/python2.7', '/app/.heroku/python/lib/python2.7/plat-linux2', '/app/.heroku/python/lib/python2.7/lib-tk', '/app/.heroku/python/lib/python2.7/lib-old', '/app/.heroku/python/lib/python2.7/lib-dynload', '/app/.heroku/python/lib/python2.7/site-packages']
so, indeed, that must be it
I need to use the interpreter from /app/.apt/..
 
yes or just add the path
either or
I am not familiar with heroku but you must have two versions of python on it?
 
no, but I guess the heroku-buildpack-apt apparantly installs everything in a separate folder, including another python interpreter
I'm just working with heroku since two days, so I'm not so familiar with it either,
.. :)
 
just out of interest what does which -a python output from bash?
 
/ $ which -a python
/app/.heroku/python/bin/python
/usr/bin/python
but I just managed to add the path and import zbar from python (WOOOHOOOO!!!)
 
3:53 PM
lol good
 
sorry, I'm really happy, because I've been working on this for about a day
 
no worries
there must be a way to set it up so yon use only one python install
will make your life easier if you can
 
I guess the reason why the separate python install is done is because you can't run apt directly
/ $ apt-get install python
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
/ $ sudo apt-get install python
bash: sudo: command not found
/ $
 
ah ok that makes sense
well anyway at least it is working now!
 
indeed
thanks a million
 
3:57 PM
no prob, enjoy your app building
 
thanks!
you made my day! :)
 
lol good
ciao :)
 
bye bye
 

last day (14 days later) »