Dask Dataframe“ValueError:数据被压缩为snappy但我们没有安装这个”

时间:2018-05-15 00:21:49

标签: python dask kubernetes-helm pyarrow

似乎安装了python-snappy - Dask返回一个ValueError。

jupyter和工人的头盔配置:

env:
  - name: EXTRA_CONDA_PACKAGES
    value: numba xarray s3fs python-snappy pyarrow ruamel.yaml -c conda-forge
  - name: EXTRA_PIP_PACKAGES
    value: dask-ml --upgrade

容器显示python-snappy(通过conda列表)

数据框是从Apache Drill生成的多部分拼花文件中加载的:

files = ['s3://{}'.format(f) for f in fs.glob(path='{}/*.parquet'.format(filename))]
df = dd.read_parquet(files)

在数据框上运行len(df)会返回:

distributed.utils - ERROR - Data is compressed as snappy but we don't have this installed
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/distributed/utils.py", line 622, in log_errors
    yield
  File "/opt/conda/lib/python3.6/site-packages/distributed/client.py", line 921, in _handle_report
    six.reraise(*clean_exception(**msg))
  File "/opt/conda/lib/python3.6/site-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/opt/conda/lib/python3.6/site-packages/distributed/comm/tcp.py", line 203, in read
    msg = yield from_frames(frames, deserialize=self.deserialize)
  File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    return
  File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper
    future.set_result(_value_from_stopiteration(e))
  File "/opt/conda/lib/python3.6/site-packages/distributed/comm/utils.py", line 75, in from_frames
    res = _from_frames()
  File "/opt/conda/lib/python3.6/site-packages/distributed/comm/utils.py", line 61, in _from_frames
    return protocol.loads(frames, deserialize=deserialize)
  File "/opt/conda/lib/python3.6/site-packages/distributed/protocol/core.py", line 96, in loads
    msg = loads_msgpack(small_header, small_payload)
  File "/opt/conda/lib/python3.6/site-packages/distributed/protocol/core.py", line 171, in loads_msgpack
    " installed" % str(header['compression']))
ValueError: Data is compressed as snappy but we don't have this installed

有人可以在这里建议正确的配置或补救步骤吗?

1 个答案:

答案 0 :(得分:1)

这个错误实际上不是来自阅读你的镶木地板文件,而是来自Dask如何压缩机器之间的数据。您可以通过在所有客户端/调度程序/工作器窗格上安装或不安装python-snappy来解决此问题。

您应该执行以下任一操作:

  1. 从您的jupyterworker广告连播的conda包列表中删除python-snappy。如果您正在使用pyarrow,那么这是不必要的,我相信Arrow在C ++级别包含了snappy。
  2. python-snappy添加到您的scheduler广告
  3. FWIW我个人建议lz4进行snappy之间的机器间压缩。