cpmech / plotpy

Rust plotting library using Python (Matplotlib)
MIT License
65 stars 6 forks source link

Error: `"np.NaN" was removed in the NumPy 2.0 release.` #45

Closed hiibolt closed 2 months ago

hiibolt commented 2 months ago

Error:

# cat aee4bdf2-0b54-4c6d-af93-9fe4848e1f76.log
Traceback (most recent call last):
  File "//assets/aee4bdf2-0b54-4c6d-af93-9fe4848e1f76.py", line 14, in <module>
    NaN = np.NaN
          ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.. Did you mean: 'nan'?

Steps to Reproduce

Use plotpy in a context where NumPy is major version 2.

Potential Solutions

Update to NumPy 2.0.0, and change the following in src/constants.rs from

# Variable to handle NaN values coming from Rust
NaN = np.NaN

...to...

# Variable to handle NaN values coming from Rust
NaN = np.nan
cpmech commented 2 months ago

Thank you again. Fixed.