Skip to content

BUG: Bad error message on read_parquet() when wrong version of pyarrow is installed #33313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
jfcorbett opened this issue Apr 6, 2020 · 4 comments · Fixed by #33361
Closed
3 tasks done
Assignees
Labels
Error Reporting Incorrect or improved errors from pandas IO Parquet parquet, feather
Milestone

Comments

@jfcorbett
Copy link
Contributor

  • 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.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()

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

@jfcorbett jfcorbett added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 6, 2020
@jorisvandenbossche jorisvandenbossche added IO Parquet parquet, feather and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 6, 2020
@jorisvandenbossche jorisvandenbossche added this to the Contributions Welcome milestone Apr 6, 2020
@jorisvandenbossche
Copy link
Member

@jfcorbett thanks for the report! That error message could indeed be improved.

Contributions welcome!

@quangngd
Copy link
Contributor

quangngd commented Apr 7, 2020

take

@jfcorbett
Copy link
Contributor Author

jfcorbett commented Apr 7, 2020

@jorisvandenbossche Done! ^^^

@quangngd Sorry if I jumped the gun! first-time contributor.

Let me try that "take" command... curious

@jfcorbett jfcorbett changed the title BUG: Bad error message on read_parquet() with wrong version of pyarrow is installed BUG: Bad error message on read_parquet() when wrong version of pyarrow is installed Apr 7, 2020
@jfcorbett
Copy link
Contributor Author

take

@quangngd quangngd removed their assignment Apr 7, 2020
@jreback jreback modified the milestones: Contributions Welcome, 1.1 Apr 7, 2020
@jreback jreback added Error Reporting Incorrect or improved errors from pandas and removed Bug labels Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas IO Parquet parquet, feather
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants