There are at least two other packages that have the name snappy.
e.g. https://pypi.org/project/python-snappy/ 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.
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/compression.py", 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?
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
ESA_SNAPPY_FOLDER=$SITE_PACKAGES_FOLDER/esa_snappy
mkdir $ESA_SNAPPY_FOLDER
touch $ESA_SNAPPY_FOLDER/__init__.py
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