Skip to content

AnyValue is having issues with numpy 2 (?) #8486

Closed
@teh-cmc

Description

@teh-cmc

This works with numpy < 2:

$ python tests/python/release_checklist/check_focus.py
# works

But fails in an environment with numpy >= 2:

$ python tests/python/release_checklist/check_focus.py
Traceback (most recent call last):
  File "/home/cmc/dev/rerun-io/rerun/tests/python/release_checklist/check_focus.py", line 57, in <module>
    run(args)
  File "/home/cmc/dev/rerun-io/rerun/tests/python/release_checklist/check_focus.py", line 48, in run
    log_some_views()
  File "/home/cmc/dev/rerun-io/rerun/tests/python/release_checklist/check_focus.py", line 36, in log_some_views
    rr.log(f"a_entity_{i}", rr.AnyValues(empty=0))
                            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/cmc/dev/rerun-io/rerun/venv312/lib/python3.12/site-packages/rerun_sdk/rerun/any_value.py", line 192, in __init__
    batch = AnyBatchValue(name, value, drop_untyped_nones=drop_untyped_nones)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cmc/dev/rerun-io/rerun/venv312/lib/python3.12/site-packages/rerun_sdk/rerun/any_value.py", line 91, in __init__
    np_value = np.atleast_1d(np.array(value, copy=False))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐍 Python APIPython logging API😤 annoyingSomething in the UI / SDK is annoying to use🪳 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions