question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

macos, brew install of python3. then, after pandas,

# pip3 install snappy
snappy in /usr/local/lib/python3.7/site-packages (2.7)
...
# pip3 install fastparquet
Requirement already satisfied: fastparquet in /usr/local/lib/python3.7/site-packages (0.3.2)
...

the simple program

#!/usr/bin/env python3
from fastparquet import write
import csv
import pandas as pd

x= pd.read_csv( "test.csv" )  ## parq always writes to file, never to stdout
print( "reading was ok" )
parq.write_dataframe( x,  "./test.parq" )
print( "writing was ok" )

yields an error

  File "/usr/local/lib/python3.7/site-packages/fastparquet/compression.py", line 45, in <module>
    compressions['SNAPPY'] = snappy.compress
AttributeError: module 'snappy' has no attribute 'compress'

snappy was installed fine, partly via brew install snappy.

hope this helps.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

26reactions
chrisroatcommented, Jan 9, 2020

pip3 install python-snappy (not pip3 install snappy)

16reactions
brunocampos01commented, Oct 5, 2020

If you have installed the snappy library try:

pip uninstall snappy python-snappy

and then reinstall:

pip install python-snappy

it worked for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'snappy' has no attribute 'decompress' - Stack Overflow
I believe you've installed SnapPy a package for geometry. You should install pip install python-snappy instead of pip install snappy .
Read more >
Re: AttributeError: module 'snappy' has no attribute 'compress'
Almost all cosmology/astrophysics/astronomy codes which is my primary interest are not working due to the error: AttributeError: module 'snappy' has no ...
Read more >
AttributeError: module 'snappy' has no attribute 'ProductIO'
Hello there. As I mentioned in the title, when I try to use the ProductIO option on the jupyter notebook, I get this...
Read more >
[sage-cell] Re: AttributeError: module 'snappy' has no attribute ...
Hi Andrey and the Team, Probably the long-standing problem "AttributeError: module 'snappy' has no attribute 'compress'" can now be solved.
Read more >
Python – module 'snappy' has no attribute 'decompress'
Python – module 'snappy' has no attribute 'decompress' ... But in both time when i'm trying to run python code where i import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found