Skip to content

Can't import with latest NumPy dev 2.4.0.dev0 #262

Description

@larsoner

See

https://dev.azure.com/mne-tools/mne-python/_build/results?buildId=34392&view=logs&jobId=dded70eb-633c-5c42-e995-a7f8d1f99d91&j=dded70eb-633c-5c42-e995-a7f8d1f99d91&t=1ccededa-7e7e-5a92-87ce-e531d760d025

C:\hostedtoolcache\windows\Python\3.13.8\x64\Lib\site-packages\neo\core\spiketrain.py:24: in <module>
    import quantities as pq
C:\hostedtoolcache\windows\Python\3.13.8\x64\Lib\site-packages\quantities\__init__.py:275: in <module>
    from . import quantity
C:\hostedtoolcache\windows\Python\3.13.8\x64\Lib\site-packages\quantities\quantity.py:113: in <module>
    class Quantity(np.ndarray):
C:\hostedtoolcache\windows\Python\3.13.8\x64\Lib\site-packages\quantities\quantity.py:632: in Quantity
    @with_doc(np.ndarray.ptp)
              ^^^^^^^^^^^^^^
E   AttributeError: type object 'numpy.ndarray' has no attribute 'ptp'

Presumably because on 2.2.6 you get this warning

>>> import numpy as np
>>> np.ndarray.ptp
<attribute 'ptp' of 'numpy.ndarray' objects>
>>> x = np.arange(10)
>>> x.ptp()
Traceback (most recent call last):
  File "<python-input-4>", line 1, in <module>
    x.ptp()
    ^^^^^
AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.

and now they've decided in 2.4.0.dev0 to actually remove it entirely.

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