Using kazoo with Zookeeper gives me ImportError: No module named kazoo.client error

1,022 views
Skip to first unread message

compte...@gmail.com

unread,
Nov 18, 2013, 5:08:34 PM11/18/13
to pyth...@googlegroups.com
I am planning to use Python kazoo library for Zookeeper. I am totally new to python so I have no idea how to get going and how to use kazoo to connect with zookeeper.

This is the document I was reading to start using kazoo for Zookeeper.

http://kazoo.readthedocs.org/en/latest/install.html

In that wiki, they have asked to install kazoo. And they are using some pip command for that?

What does pip do here? And I am currently using windows so I have cygwin installed and python installed as well. I am using Python 2.7.3

    host@D-SJC-00542612 ~
    $ python
    Python 2.7.3 (default, Dec 18 2012, 13:50:09)
    [GCC 4.5.3] on cygwin

Now what I did is - I copied this command exactly as it is from the above website - `pip install kazoo` and ran it on my cygwin command prompt.

    host@D-SJC-00542612 ~
    $ pip install kazoo
    Downloading/unpacking kazoo
      Running setup.py egg_info for package kazoo

        warning: no previously-included files found matching '.gitignore'
        warning: no previously-included files found matching '.travis.yml'
        warning: no previously-included files found matching 'Makefile'
        warning: no previously-included files found matching 'run_failure.py'
        warning: no previously-included files matching '*' found under directory 'sw'
        warning: no previously-included files matching '*pyc' found anywhere in distribution
        warning: no previously-included files matching '*pyo' found anywhere in distribution
    Downloading/unpacking zope.interface>=3.8.0 (from kazoo)
      Running setup.py egg_info for package zope.interface

        warning: no previously-included files matching '*.dll' found anywhere in distribution
        warning: no previously-included files matching '*.pyc' found anywhere in distribution
        warning: no previously-included files matching '*.pyo' found anywhere in distribution
        warning: no previously-included files matching '*.so' found anywhere in distribution
    Requirement already satisfied (use --upgrade to upgrade): distribute in c:\python27\lib\site-packages (from zope.interface>=3.8.0->kazoo)
    Installing collected packages: kazoo, zope.interface
      Running setup.py install for kazoo

        warning: no previously-included files found matching '.gitignore'
        warning: no previously-included files found matching '.travis.yml'
        warning: no previously-included files found matching 'Makefile'
        warning: no previously-included files found matching 'run_failure.py'
        warning: no previously-included files matching '*' found under directory 'sw'
        warning: no previously-included files matching '*pyc' found anywhere in distribution
        warning: no previously-included files matching '*pyo' found anywhere in distribution
      Running setup.py install for zope.interface

        warning: no previously-included files matching '*.dll' found anywhere in distribution
        warning: no previously-included files matching '*.pyc' found anywhere in distribution
        warning: no previously-included files matching '*.pyo' found anywhere in distribution
        warning: no previously-included files matching '*.so' found anywhere in distribution
        building 'zope.interface._zope_
interface_coptimizations' extension
        ********************************************************************************
        WARNING:

                An optional code optimization (C extension) could not be compiled.

                Optimizations for this package will not be available!
        ()
        Unable to find vcvarsall.bat
        ********************************************************************************
        Skipping installation of C:\Python27\Lib\site-packages\zope\__init__.py (namespace package)
        Installing C:\Python27\Lib\site-packages\zope.interface-4.0.5-py2.7-nspkg.pth
    Successfully installed kazoo zope.interface
    Cleaning up...

Does it got installed properly? Now I can start writing code in python to connect with zookeeper? Ok I thought lets start writing some simple Python code here to connect with Zookeeper

I wrote this simple python code here -

    #!/usr/bin/python

    from kazoo.client import KazooClient

    zk = KazooClient(hosts='127.0.0.1:2181')
    zk.start()

    print "Hello, Python!";

And as soon as I run it from the cygwin command prompt. I always get this error -     `ImportError: No module named kazoo.client`

    host@D-SJC-00542612 /cygdrive/c/ZookPython
    $ python test1.py
    Traceback (most recent call last):
      File "test1.py", line 3, in <module>
        from kazoo.client import KazooClient
    ImportError: No module named kazoo.client


Any idea what wrong I am doing here? I know its a basic question but somehow I am not able to make it work as I dont have that much experience with Python

Ganesh G Kurup

unread,
Feb 28, 2014, 9:00:14 AM2/28/14
to pyth...@googlegroups.com

I have the same issue but with another library (decorator). 
Any idea why this happens. Installation ends with "Successfully installed decorator"
But when the code runs it returns Module "decorator not found". 

Thanks in advance
Reply all
Reply to author
Forward
0 new messages