Woody
Woody

Reputation: 111

ModuleNotFoundError when importing pyarrow

I'm facing on import error when trying to upgrade by pyarrow dependency. More particularly, it fails with the following import:

from pyarrow import dataset as pa_ds

This will give the following error

File "[ENV]/lib/python3.8/site-packages/pyarrow/dataset.py", line 24, in from pyarrow._dataset import ( # noqa ModuleNotFoundError: No module named 'pyarrow._dataset'

I'm having this issue with both pyarrow 3.0.0 and 2.0.0. The same import works on pyarrow 1.0.1 though. I installed pyarrow through conda. Really don't know what went wrong here.

Upvotes: 1

Views: 2651

Answers (1)

diana
diana

Reputation: 21

This fixed that error for me. Note that I'm building from source though.

$ export PYARROW_WITH_DATASET=1

Before:

>>> import pyarrow
>>> import pyarrow.dataset
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/diana/workspace/arrow/python/pyarrow/dataset.py", line 23, in <module>
    from pyarrow._dataset import (  # noqa

After:

$ cd workspace/arrow/python/
$ export PYARROW_WITH_DATASET=1
$ python setup.py build_ext --inplace
$ python
>>> import pyarrow
>>> import pyarrow.dataset
>>> 
>>> print("happy dance!")

Upvotes: 2

Related Questions