Code Sample, a copy-pastable example
With pyarrow<0.13 installed,
pd.read_parquet('some_file.parquet')
Problem description
The error message says that pyarrow should be installed, even though pyarrow is already installed – which makes the error difficult to diagnose and fix, when in fact, the problem is an incompatible version of pyarrow.
File "[...]\lib\site-packages\pandas\io\parquet.py", line 33, in get_engine
"Unable to find a usable engine; "
ImportError: Unable to find a usable engine; tried using: 'pyarrow', 'fastparquet'.
pyarrow or fastparquet is required for parquet support
Expected Output
The message should state the real cause of the error, namely an incompatible version of pyarrow. Like:
File "[...]\lib\site-packages\pandas\io\parquet.py", line 40, in get_engine
return PyArrowImpl()
File "[...]\lib\site-packages\pandas\io\parquet.py", line 75, in __init__
"pyarrow", extra="pyarrow is required for parquet support."
File "[...]\lib\site-packages\pandas\compat\_optional.py", line 109, in import_optional_dependency
raise ImportError(msg)
ImportError: Pandas requires version '0.13.0' or newer of 'pyarrow' (version '0.11.1' currently installed).
This helpful error message does in fact get generated at a lower level in pandas.compat._optional.import_optional_dependency(), but then gets swallowed when its client pandas.io.parquet.get_engine(engine="auto") raises a new ImportError from scratch.
Output of pd.show_versions()
Details
INSTALLED VERSIONS
commit : None
python : 3.7.7.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : None.None
pandas : 1.0.3
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.1.3.post20200330
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : 0.11.1
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
With
pyarrow<0.13installed,Problem description
The error message says that
pyarrowshould be installed, even thoughpyarrowis already installed – which makes the error difficult to diagnose and fix, when in fact, the problem is an incompatible version of pyarrow.Expected Output
The message should state the real cause of the error, namely an incompatible version of pyarrow. Like:
This helpful error message does in fact get generated at a lower level in
pandas.compat._optional.import_optional_dependency(), but then gets swallowed when its clientpandas.io.parquet.get_engine(engine="auto")raises a newImportErrorfrom scratch.Output of
pd.show_versions()Details
INSTALLED VERSIONS
commit : None
python : 3.7.7.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : None.None
pandas : 1.0.3
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.1.3.post20200330
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : 0.11.1
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None