Lostsoul Lostsoul - 1 year ago 75
Python Question

How can I import hbase in python?

I'm trying to play around with hbase in python and I am using the cloudera repository to install the hadoop/hbase packages. It seems to work as I can access and work on the database using the shell but its not fully working within python.

I know to communicate with hbase I need thrift so I downloaded and complied it from source, I can import thrift into python but when I do

from hbase import Hbase
, I get module not found errors.

Does anyone know what package/module I would need to get it to work? I tried to look around easy_install and yum(I'm using centos6) and no luck. I did find an article where a person using debain installed it by doing
sudo aptiutde install python-hbase
I don't have that command/package, so I'm not sure how to get it(or if I have to compile from source to get it).

Also if it helps, I installed most of the base from cloudera and followed some instructions(the ones didn't require install) from http://yannramin.com/2008/07/19/using-facebook-thrift-with-python-and-hbase/

Any help/tips/suggestions would be great.


Answer Source

Okay, I figured it out. If anyone else is having problems with this in the future its actually pretty easy. In the step where you run thrift --gen py Hbase.thrift, it creates a hbase folder in the location you ran that command. Simply take that command and copy it to your default module folder(or in the folder where you run your program and it should work).