Search code examples
pythonpython-3.xkafka-consumer-apisnappy

module 'snappy' has no attribute 'decompress'


I'm tring to use kafka-python. It request to install Snappy. So I install it by

  1. pip install snappy
  2. pip install python_snappy-0.5.2-cp36-cp36m-win_amd64.whl In both ways Snappy install successfully.

But in both time when i'm trying to run python code where i import 'kafka', i got an error.

Error:

AttributeError: module 'snappy' has no attribute 'decompress'

When I run,

import snappy
help(snappy)

Result is:

Help on package snappy:

NAME
    snappy

PACKAGE CONTENTS
    __main__
    _snappy
    hadoop_snappy
    snappy
    snappy_cffi
    snappy_cffi_builder
    snappy_formats

FILE
    (built-in)

I'm using conda in Windows environment (Win 10).

How can i overcome this problem?


Solution

  • I believe you've installed SnapPy a package for geometry. You should install pip install python-snappy instead of pip install snappy. The snappy package you're looking for is here Python-snappy