未安装RuntimeError pyarrow

时间:2019-04-06 20:57:52

标签: python parquet pyarrow

我在使用pip的Ubuntu 16.04上的虚拟环境中安装了pyarrow 0.13.0,并成功安装了它,但是每当我调用它时,都会收到以下错误消息。

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/dask/utils.py in import_required(mod_name, error_msg)
     90     try:
---> 91         return import_module(mod_name)
     92     except ImportError:

~/anaconda3/lib/python3.7/importlib/__init__.py in import_module(name, package)
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 

~/anaconda3/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

~/anaconda3/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'pyarrow'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-2-6c07c44edca9> in <module>
      1 df = dd.read_parquet(
      2     'sample_10percent_value_1000_only.parquet', engine='pyarrow',
----> 3     columns=['argument_0', 'func_name', 'symbol', 'location', 'script_url']
      4 )
      5 df.head()

~/anaconda3/lib/python3.7/site-packages/dask/dataframe/io/parquet.py in read_parquet(path, columns, filters, categories, index, storage_options, engine, infer_divisions)
   1141         paths = path
   1142     else:
-> 1143         read = get_engine(engine)['read']
   1144         fs, fs_token, paths = get_fs_token_paths(
   1145             path, mode='rb',

~/anaconda3/lib/python3.7/site-packages/dask/dataframe/io/parquet.py in get_engine(engine)
   1035 
   1036     elif engine == 'pyarrow':
-> 1037         pa = import_required('pyarrow', "`pyarrow` not installed")
   1038 
   1039         if LooseVersion(pa.__version__) < '0.8.0':

~/anaconda3/lib/python3.7/site-packages/dask/utils.py in import_required(mod_name, error_msg)
     91         return import_module(mod_name)
     92     except ImportError:
---> 93         raise RuntimeError(error_msg)
     94 
     95 

RuntimeError: `pyarrow` not installed `

1 个答案:

答案 0 :(得分:0)

您是否激活/切换到了安装的环境?还是您不小心尝试从基本环境中导入?只是一个简单的想法...

BSONObject personBsonObj = BasicDBObjectBuilder.start()
                .add("firstName","John")
                .add("lastName", null)
                .add("email","john.kerr@gmail.com")
                .add("hobbies",Arrays.asList(hobbies1, hobbies2, hobbies4)).get();

        BSONObject insert = mongoTemplate.insert(personBsonObj,"person");
        System.out.println(insert);