-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: Pyarrow dependency warning starts with newline which makes it impossible to filter out by message with -W or PYTHONWARNINGS #57082
Comments
This works: |
As the doc says, regexes are accepted in |
Ah I didn't know that. I assumed it would, since it did work within my pytest config. |
Yeah filterwarnings accepts regex contrary to |
Thanks for the report, a linked PR is already up to resolve this. |
Nice, thanks! This is #57003 indeed. I looked for an open PR but didn't find it somehow ... |
Just to be sure, I stated "already up" as more of a celebration and not an indication this shouldn't have been reported. I would only expect searching the issue tracker and not PRs. |
Yep that's the way I understood it! I am quite happy someone had a similar issue as me and took the time to open a PR in pandas with some additional explanations. To me, it seems quite a weird Python quirk that it is not possible to filter out a message starting with a whitespace with |
@lithomas1 - I've marked this as a blocker for 2.2.1. Either we should remove the newline, or the entire deprecation, but either way I think this issue needs to be resolved for 2.2.1. |
Yep, this is on my radar - was planning to bring it up at the meeting next week. |
Preemptively +100 to remove the deprecation warning in 2.2.1 |
Could you also remove the entire github link in the message or at least the for example, you can see the problem here: It's easier to change this message than going and ask cpython to fix it I believe. |
@mimizone you probably know this already but you don't have to use the full message, it only needs to match at the beginning. Since "https://" is towards the end of the message, I don't think it matters. For example if there was not the newline at the start you could ignore the message like this:
or
|
thanks @lesteve for clarifying this point |
In the meantime, in case somebody is interested in filtering this in the context of Jupyter. I did it using the ipython config, which works well in my context. |
The warning ended up being removed in #57556 so closing. The warning will not appear in 2.2.1 |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Issue Description
I would expect that the Pyarrow warning is easily ignorable by message i.e. something like the following does not produce any warning:
The issue is that because the warning starts with a newline it can not be targetted by message. This seems to be the case of any warning that starts with some kind of whitespace character.
I tried a variety of things like
-W 'ignore:\nPyarrow:DeprecationWarning'
but I could not make it work. I think the reason is the "ignoring any whitespace at the start or end of message" from the warnings documentation:In scikit-learn tests warnings are turned into errors with
pytest -W
and we would like to use-W
too to ignore the Pyarrow dependency warning for now. A possible work-around is to use filterwarnings which accept a regex, see Note in https://docs.pytest.org/en/stable/how-to/capture-warnings.html#controlling-warnings for more details, but being able to use-W
orPYTHONWARNINGS
seems desirable e.g. to control warnings from the command-line outside of pytest.Expected Behavior
There is an easy way with
-W
orPYTHONWARNINGS
to ignore the Pyarrow DeprecationWarning e.g.Installed Versions
pandas : 2.2.0
numpy : 1.26.3
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.2
Cython : 0.29.35
pytest : 7.4.0
hypothesis : None
sphinx : 6.0.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.18.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.12.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : 0.21.0
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: