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

Skip to first unread message

Elimboto Yohana

Jul 29, 2021, 7:05:19 AM7/29/21
to sage-cell, Andrey Novoseltsev
Hi Andrey and the Team,

Probably the long-standing problem "AttributeError: module 'snappy' has no attribute 'compress'" can now be solved. A GitHub reply by "martindurant"  -- "Note that this will no longer happen, fastparquet recent releases always support snappy via cramjam" suggests that the installation of cramjam can solve the problem:

pip install cramjam (

I will also appreciate if you can install xlrd (pip install xlrd -- which is used by autoviz as "from autoviz.AutoViz_Class import AutoViz_Class" raises the error "ModuleNotFoundError: No module named 'xlrd'".

Kind regards,


On Sun, Jul 25, 2021 at 2:59 PM Elimboto Yohana <> wrote:
Hi Andrey,

Almost all cosmology/astrophysics/astronomy codes which is my primary interest are not working due to the error: AttributeError: module 'snappy' has no attribute 'compress'. Similarly, most of the Plotly modules will raise the same error.

Anything to do with Astropy, HDF5/h5py, astronomical data compression, Ploly modules such as, and more will complain about Snappy and will never work.

Snappy module is a big issue now, can't something be done on your side?

Kind regards,


Andrey Novoseltsev

Aug 2, 2021, 11:33:38 PM8/2/21
to sage-cell

Also, for the record, I never got that email from July 25 ;-)


Elimboto Yohana

Aug 3, 2021, 3:44:52 AM8/3/21
to Andrey Novoseltsev, sage-cell
Thank you Andrey. This error is still there "AttributeError: module 'snappy' has no attribute 'compress'. You can confirm that by trying to import either of the modules below:

from cramjam import snappy
#from import fits
#from astropy.visualization import astropy_mpl_style
#from astropy.coordinates import SkyCoord, EarthLocation
#from astropy import coordinates as coord
#from astropy.coordinates.tests.utils import randomly_sample_sphere

I will explore the problem locally and let you know of the possible solution.

Kind regards,


You received this message because you are subscribed to the Google Groups "sage-cell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Elimboto Yohana

Aug 4, 2021, 3:19:29 PM8/4/21
to Andrey Novoseltsev, sage-cell
Hi Andrey,

There are at least three Python packages with the name snappy:

This can be install as pip install snappy, and the command installs the following packages: FXrays-1.3.5 cypari-2.4.1 decorator-4.4.2 future-0.18.2 knot-floer-homology-1.0.2 plink-2.4 pypng-0.0.20 snappy-3.0.1 snappy-manifolds-1.1.2 spherogram-2.0.

2. snappy-manifolds 1.1.2 ( -- pip install snappy-manifolds: This one is part of the snappy package above.

3. python-snappy 0.6.0 ( -- pip install python-snappy: This is the one that other packages which use it complain it has no attribute compress.

I installed all these packages one by one and tested the codes with Python 3.9.6 (and also with Ipython 7.16.1) under Ubuntu-Linux 18.04 and did not notice any conflicts or an error in question.

Maybe later upgrade from python 3.9.2 to a higher version or uninstalling and reinstalling the snappy and python-snappy packages can solve the problem.

Kind regards,

Reply all
Reply to author
0 new messages