在python中导入fastparquet时出现snappy错误

时间:2017-06-01 07:31:29

标签: python anaconda conda snappy fastparquet

我已经在我的EC2服务器上安装了以下模块,这些模块已经有了python(3.6)& anaconda安装:

  • 活泼
  • pyarrow
  • s3fs
  • fastparquet

除了fastparquet,其他一切都在导入。当我尝试导入fastparquet时,它会抛出以下错误:

[username@ip8 ~]$ conda -V
conda 4.2.13
[username@ip-~]$ python
    Python 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
     import fastparquet
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/__init__.py", line 15, in <module>
        from .core import read_thrift
      File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/core.py", line 11, in <module>
        from .compression import decompress_data
      File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/compression.py", line 43, in <module>
        compressions['SNAPPY'] = snappy.compress
    AttributeError: module 'snappy' has no attribute 'compress'

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:8)

不幸的是,python-land中有很多东西叫做#34; snappy&#34;。我相信你可能有错误,在这种情况下,以下conda命令之一应该为你解决这个问题:

conda install python-snappy

conda install python-snappy -c conda-forge

后者稍微更近一些(释放GIL,这在线程应用程序中很重要)。