Skip to content

deeplake 3.9.52 incompatible with NumPy 2.x (NEP 50): TypeError in get_incompatible_dtype #3144

@LuigiGonnella

Description

@LuigiGonnella

Bug Report

Environment

  • deeplake==3.9.52
  • numpy>=2.0 (tested on 2.4.2)

Description

NumPy 2.x (NEP 50) removed support for passing raw Python scalars (int, float, bool) as the first argument to np.can_cast. This causes a TypeError when DeepLake attempts to validate scalar samples in get_incompatible_dtype inside deeplake/util/casting.py.

Error

TypeError: can_cast() does not support Python ints, floats, and complex because the result used to depend on the value.

The offending line in deeplake/util/casting.py:

if np.can_cast(samples, dtype)  # samples is a raw Python float/int

Fix

A fix is available in this PR:
#3143

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions