Skip to content

Fix compatibility with dask 2024.3+ - #43

Open
dcolinmorgan wants to merge 1 commit into
aertslab:masterfrom
dcolinmorgan:fix/modern-dask-compatibility
Open

Fix compatibility with dask 2024.3+#43
dcolinmorgan wants to merge 1 commit into
aertslab:masterfrom
dcolinmorgan:fix/modern-dask-compatibility

Conversation

@dcolinmorgan

Copy link
Copy Markdown

Fix compatibility with dask 2024.3+

Problem

Arboreto currently fails to import with modern dask versions (2024.3+):

from arboreto.algo import grnboost2
# NotImplementedError: The legacy implementation is no longer supported

This is because dask 2024.3+ removed the legacy dataframe implementation in favor of dask-expr query planning.

Solution

Add compatibility layer that:

  1. Tries importing from dask.dataframe (legacy/older versions)
  2. Falls back to dask-expr imports (modern versions)
  3. Provides clear error message if neither works

Testing

Tested with:

  • ✅ dask 2024.12.0 + pandas 2.2.0 + Python 3.11
  • ✅ dask 2024.2.1 + pandas 2.0.0 + Python 3.10 (backwards compatible)
  • ✅ dask 2023.x (legacy versions still work)

Changes

  • Modified arboreto/core.py imports only
  • No API changes
  • Fully backwards compatible

Related Issues

This affects users trying to use arboreto with:

  • Modern Python environments (3.11+)
  • Recent pandas versions (2.0+)
  • Current dask releases

Would appreciate review and merge to unblock users on modern dependency stacks!

Modern dask (2024.3+) removed the legacy dataframe implementation in favor
of dask-expr query planning. This causes ImportError when trying to import
from dask.dataframe.utils.

Changes:
- Add try/except for dask.dataframe imports
- Fallback to dask-expr imports for modern dask versions
- Provide graceful error message if neither is available

Fixes compatibility with:
- dask >= 2024.3.0
- Python 3.11+
- Modern pandas versions

Tested with dask 2024.12.0 and pandas 2.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant