9

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?

GihanDB
  • 591
  • 2
  • 6
  • 23

1 Answers1

24

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

thuyein
  • 1,684
  • 13
  • 29
  • 2
    Don't forget to `apt install libsnappy-dev` BEFORE installing pip package on Ubuntu 20.04 LTS – Riki137 May 05 '20 at 14:49
  • 1
    @Riki137 genius! Exactly what happened to me. `libsnappy-dev` was installed, and so was `snappy` in `pip`. But they it didn't work until I reinstalled `snappy` – Ufos Jun 16 '20 at 10:33