Snappy name conflict with other packages

There are at least two other packages that have the name snappy.

e.g. for the google compression library which is used by dask. So it is at the moment not possible to use snappy in the same python environment as dask.

You should change the name and register a proper python package at pypi.


I agree the name should be changed.

In case you need a workaround in the meantime, the following seems to work:

  • Rename the directory /home/your_username/.snap/snap-python/snappy to snappy_esa,
  • Rename the file /home/your_username/.snap/snap-python/snappy_esa/snappy.ini to snappy_esa.ini.

You can then import from python using import snappy_esa.


I’ve created an issue for this problem. SNAP-936

FYI: dask was recently made more robust against the snappy name conflict issue:

The fix is not in a public release at the moment, but I guess with a dask version above 1.2.2 you won’t get errors like

File "/path/to/lib/python2.7/site-packages/dask/bytes/", line 31, in <module>
    compress['snappy'] = snappy.compress
AttributeError: 'module' object has no attribute 'compress'

when you use dask/xarray/… together with ESA snappy in the same (virtual) environment


I tried this workaround but am still getting AttributeError: module ‘snappy’ has no attribute ‘compress’’ when trying to use xarray. Any ideas?

1 Like

Currently this is an issue with the distributed library. But over time others will pop up if that is not fixed.

At the moment we are working around it by just “installing” snappy under the esa_snappy.snappy module by running something like this during installation

SITE_PACKAGES_FOLDER=$(python -c 'import site; print(site.getsitepackages()[0])')
# copy snappy into current python environment under the esa_snappy.snappy module
cp -r lib/snappy $ESA_SNAPPY_FOLDER

You should then be able to use snappy from python by doing

    from esa_snappy.snappy import HashMap
    from esa_snappy.snappy import ProductIO
    from esa_snappy.snappy import GPF
    from esa_snappy.snappy import jpy