[Data] Cap pandas to <3 for ray[data] and make SettingWithCopyWarning handling pandas-3-safe#60406
[Data] Cap pandas to <3 for ray[data] and make SettingWithCopyWarning handling pandas-3-safe#60406daiping8 wants to merge 7 commits intoray-project:masterfrom
Conversation
…setup files - Updated pandas dependency in requirements.txt to specify version range: >=1.3,<3. - Adjusted setup.py to reflect the same version constraints for Ray Data, ensuring compatibility with future pandas versions. - Modified data_batch_conversion.py and util/data_batch_conversion.py to handle potential changes in SettingWithCopyWarning across pandas versions. This change is aimed at maintaining compatibility with upcoming pandas releases while avoiding breaking changes in the codebase. Change-Id: I64b4b464ed63350839c365a81e65f0d6e4b0f53f Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
There was a problem hiding this comment.
Code Review
This pull request correctly caps the pandas dependency to <3 to avoid runtime breakages in Ray Data and makes the SettingWithCopyWarning handling more robust. The changes to setup.py and requirements.txt are appropriate.
My review includes suggestions to improve the maintainability of the warning handling code in data_batch_conversion.py by simplifying the logic and addressing code duplication. I've also pointed out a duplicated dependency in requirements.txt that could be cleaned up.
|
need @ray-project/ray-data comments. |
|
@daiping8 after fix to |
After fixing the warning, it no longer crashes. You can run the test cases in the PR Description. |
nice, so we can close this PR now? feel like ray data team is trying to support running with |
I think it can be merged, but we'd better check with others for their opinions. Pandas 3.0.0 was released on January 21, 2026. I think it will take some time to identify bugs and formulate a support plan for Ray Data. |
|
we do not upper bound version if it is not broken. that is library user's choice and freedom.
user can cap with additional requirement constraints themselves if desired. or use our images / tested compiled lock files if stability is the priority.
@bveeramani what do you think?
just in case that balaji/data team accepts this, if this PR wants to be merged, it needs to update the requirement / lock files in the repo. no rush though. |
|
@daiping8 could you help me understand -- other than the breaking change to |
aslonnie
left a comment
There was a problem hiding this comment.
(waiting for @ray-project/ray-data to understand the context and make a decision)
…ithCopyWarning retrieval Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
…tions Signed-off-by: daiping8 <dai.ping88@zte.com.cn>

Description
Summary
This PR prevents
pip install "ray[data]"from pulling inpandas==3.*(which currently breaks Ray Data at runtime), and hardens Ray's warning-handling code to avoid crashing ifSettingWithCopyWarningis missing.Changes
pandasrequirement to>=1.3,<3forray[data](and alignray[tune]to use the same bound) inpython/setup.py.SettingWithCopyWarninglookup in:python/ray/air/util/data_batch_conversion.py python/ray/data/util/data_batch_conversion.pyto gracefully degrade when the warning isn’t available.python/requirements.txttopandas>=1.3,<3.How to reproduce
Execute the following code before and after applying the patch of this PR.
Related issues
Closes #60402"