Datashader 有 snappy 错误
Datashader has snappy error
我使用 python 的 datashader 0.5.0 包来绘制人口密度信息,一般遵循教程 https://www.continuum.io/blog/developer-blog/analyzing-and-visualizing-big-data-interactively-your-laptop-datashading-2010-us。我使用 conda install -c bokeh datashader=0.5.0
.
安装了数据着色器
一切都很好。尽管可能无关紧要,但我一安装 haloviews 和 geoviews 包,事情似乎就崩溃了。安装这些额外的包后,我无法再导入数据着色器,我曾经的工作代码也不再运行。导入数据着色器时,出现以下错误:
AttributeError: 模块 'snappy' 没有属性 'compress'
我在 运行 windows 10,anaconda python 3.5.3.
也许我走错了兔子洞,但我认为这可能是 snappy 包的问题。我运行"conda install -c conda-forge snappy=1.1.4"。 conda list 显示已安装 snappy。 Snappy 确实导入。未找到 snappy.compress 对象。我的问题似乎与以下 SO post 有关,因为我在尝试 geoviews 时也遇到了 fastparquet 错误:
运行import snappy
时,print(snappy.__filename__)
出现如下错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-b8565733b383> in <module>()
----> 1 import snappy; print(snappy.__file__)
AttributeError: module 'snappy' has no attribute '__file__'
为了以防万一,我也尝试通过 conda 和 pip 进行卸载。还是不开心。
运行 "pip install python-snappy" 导致 "failed building wheel for python-snappy" 错误,前面有“错误:需要 Microsoft Visual C++ 14.0...” 所以我去得到了 "Microsoft Visual C++ Redistributable for Visual Studio 2017"和 运行 它,但没有变化。
关于如何解决这个问题有什么想法吗?作为参考,数据着色器导入的完整错误如下:
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-3d7b1ff9e530> in <module>()
----> 1 import datashader
C:\Python\lib\site-packages\datashader\__init__.py in <module>()
3 __version__ = '0.5.0'
4
----> 5 from .core import Canvas
6 from .reductions import (count, any, sum, min, max, mean, std, var, count_cat,
7 summary)
C:\Python\lib\site-packages\datashader\core.py in <module>()
3 import numpy as np
4 from datashape.predicates import istabular
----> 5 from odo import discover
6 from xarray import DataArray
7
C:\Python\lib\site-packages\odo\__init__.py in <module>()
63 from .backends.url import URL
64 with ignoring(ImportError):
---> 65 from .backends.dask import dask
66
67
C:\Python\lib\site-packages\odo\backends\dask.py in <module>()
8
9 from dask.array.core import Array, from_array
---> 10 from dask.bag.core import Bag
11 import dask.bag as db
12 from dask.compatibility import long
C:\Python\lib\site-packages\dask\bag\__init__.py in <module>()
1 from __future__ import absolute_import, division, print_function
2
----> 3 from .core import (Bag, Item, from_sequence, from_url, to_textfiles, concat,
4 from_delayed, map_partitions, bag_range as range,
5 bag_zip as zip, bag_map as map)
C:\Python\lib\site-packages\dask\bag\core.py in <module>()
30
31 from ..base import Base, normalize_token, tokenize
---> 32 from ..bytes.core import write_bytes
33 from ..compatibility import apply, urlopen
34 from ..context import _globals, defer_to_globals
C:\Python\lib\site-packages\dask\bytes\__init__.py in <module>()
2
3 from ..utils import ignoring
----> 4 from .core import read_bytes, open_files, open_text_files
5
6 from . import local
C:\Python\lib\site-packages\dask\bytes\core.py in <module>()
7 from warnings import warn
8
----> 9 from .compression import seekable_files, files as compress_files
10 from .utils import (SeekableFile, read_block, infer_compression,
11 infer_storage_options, build_name_function)
C:\Python\lib\site-packages\dask\bytes\compression.py in <module>()
30 with ignoring(ImportError):
31 import snappy
---> 32 compress['snappy'] = snappy.compress
33 decompress['snappy'] = snappy.decompress
34
AttributeError: module 'snappy' has no attribute 'compress'
事实证明,在添加软件包时,某些东西搞砸了 snappy 安装。我遵循了这个解决方案:
这是一个简单的错误,不是数据着色器问题,但我会留下 post 以防有人遇到相同系列的问题。
我使用 python 的 datashader 0.5.0 包来绘制人口密度信息,一般遵循教程 https://www.continuum.io/blog/developer-blog/analyzing-and-visualizing-big-data-interactively-your-laptop-datashading-2010-us。我使用 conda install -c bokeh datashader=0.5.0
.
一切都很好。尽管可能无关紧要,但我一安装 haloviews 和 geoviews 包,事情似乎就崩溃了。安装这些额外的包后,我无法再导入数据着色器,我曾经的工作代码也不再运行。导入数据着色器时,出现以下错误: AttributeError: 模块 'snappy' 没有属性 'compress'
我在 运行 windows 10,anaconda python 3.5.3.
也许我走错了兔子洞,但我认为这可能是 snappy 包的问题。我运行"conda install -c conda-forge snappy=1.1.4"。 conda list 显示已安装 snappy。 Snappy 确实导入。未找到 snappy.compress 对象。我的问题似乎与以下 SO post 有关,因为我在尝试 geoviews 时也遇到了 fastparquet 错误:
运行import snappy
时,print(snappy.__filename__)
出现如下错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-b8565733b383> in <module>()
----> 1 import snappy; print(snappy.__file__)
AttributeError: module 'snappy' has no attribute '__file__'
为了以防万一,我也尝试通过 conda 和 pip 进行卸载。还是不开心。
运行 "pip install python-snappy" 导致 "failed building wheel for python-snappy" 错误,前面有“错误:需要 Microsoft Visual C++ 14.0...” 所以我去得到了 "Microsoft Visual C++ Redistributable for Visual Studio 2017"和 运行 它,但没有变化。
关于如何解决这个问题有什么想法吗?作为参考,数据着色器导入的完整错误如下:
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-3d7b1ff9e530> in <module>()
----> 1 import datashader
C:\Python\lib\site-packages\datashader\__init__.py in <module>()
3 __version__ = '0.5.0'
4
----> 5 from .core import Canvas
6 from .reductions import (count, any, sum, min, max, mean, std, var, count_cat,
7 summary)
C:\Python\lib\site-packages\datashader\core.py in <module>()
3 import numpy as np
4 from datashape.predicates import istabular
----> 5 from odo import discover
6 from xarray import DataArray
7
C:\Python\lib\site-packages\odo\__init__.py in <module>()
63 from .backends.url import URL
64 with ignoring(ImportError):
---> 65 from .backends.dask import dask
66
67
C:\Python\lib\site-packages\odo\backends\dask.py in <module>()
8
9 from dask.array.core import Array, from_array
---> 10 from dask.bag.core import Bag
11 import dask.bag as db
12 from dask.compatibility import long
C:\Python\lib\site-packages\dask\bag\__init__.py in <module>()
1 from __future__ import absolute_import, division, print_function
2
----> 3 from .core import (Bag, Item, from_sequence, from_url, to_textfiles, concat,
4 from_delayed, map_partitions, bag_range as range,
5 bag_zip as zip, bag_map as map)
C:\Python\lib\site-packages\dask\bag\core.py in <module>()
30
31 from ..base import Base, normalize_token, tokenize
---> 32 from ..bytes.core import write_bytes
33 from ..compatibility import apply, urlopen
34 from ..context import _globals, defer_to_globals
C:\Python\lib\site-packages\dask\bytes\__init__.py in <module>()
2
3 from ..utils import ignoring
----> 4 from .core import read_bytes, open_files, open_text_files
5
6 from . import local
C:\Python\lib\site-packages\dask\bytes\core.py in <module>()
7 from warnings import warn
8
----> 9 from .compression import seekable_files, files as compress_files
10 from .utils import (SeekableFile, read_block, infer_compression,
11 infer_storage_options, build_name_function)
C:\Python\lib\site-packages\dask\bytes\compression.py in <module>()
30 with ignoring(ImportError):
31 import snappy
---> 32 compress['snappy'] = snappy.compress
33 decompress['snappy'] = snappy.decompress
34
AttributeError: module 'snappy' has no attribute 'compress'
事实证明,在添加软件包时,某些东西搞砸了 snappy 安装。我遵循了这个解决方案: