Aviary icon indicating copy to clipboard operation
Aviary copied to clipboard

Numpy 2.0 support

Open timryanb opened this issue 9 months ago • 1 comments

Desired capability or behavior.

It looks like Aviary doesn't currently support Numpy 2.0. I tried updating my numpy install and running an Aviary example and ran into this error:

  File "/Users/trbrooks/git/om-Aviary/aviary/examples/run_aviary_example.py", line 11, in <module>
    import aviary.api as av
  File "/Users/trbrooks/git/om-Aviary/aviary/api.py", line 35, in <module>
    from aviary.interface.default_phase_info.two_dof_fiti import phase_info as default_2DOF_fiti_phase_info
  File "/Users/trbrooks/git/om-Aviary/aviary/interface/default_phase_info/two_dof_fiti.py", line 1, in <module>
    from aviary.mission.gasp_based.phases.time_integration_phases import SGMGroundroll, \
  File "/Users/trbrooks/git/om-Aviary/aviary/mission/gasp_based/phases/time_integration_phases.py", line 3, in <module>
    from aviary.mission.gasp_based.ode.accel_ode import AccelODE
  File "/Users/trbrooks/git/om-Aviary/aviary/mission/gasp_based/ode/accel_ode.py", line 9, in <module>
    from aviary.mission.gasp_based.ode.time_integration_base_classes import add_SGM_required_inputs, add_SGM_required_outputs
  File "/Users/trbrooks/git/om-Aviary/aviary/mission/gasp_based/ode/time_integration_base_classes.py", line 7, in <module>
    from simupy.block_diagram import DEFAULT_INTEGRATOR_OPTIONS, SimulationMixin
  File "/Users/trbrooks/mambaforge/envs/OpenMDAO/lib/python3.12/site-packages/simupy/block_diagram.py", line 5, in <module>
    from simupy.utils import callable_from_trajectory
  File "/Users/trbrooks/mambaforge/envs/OpenMDAO/lib/python3.12/site-packages/simupy/utils/__init__.py", line 138, in <module>
    def isclose(res1, res2, p=np.Inf, atol=1E-8, rtol=1E-5, mode='numpy', for_="output",
                              ^^^^^^
  File "/Users/trbrooks/mambaforge/envs/OpenMDAO/lib/python3.12/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.Inf` was removed in the NumPy 2.0 release. Use `np.inf` instead.. Did you mean: 'inf'?

It looks like the issue is with the simupy library which hasn't been updated in 3 years. Not sure if there are other instances in the code that need to be updated too.

Is your feature request related to a problem? Please describe.

No response

Associated Bug Report

No response

timryanb avatar Mar 25 '25 20:03 timryanb

Numpy 2.0 is on our radar and we'd like to support, but yeah simupy is holding that back. We have plans to address it, probably a month or two out before we'll be ready

jkirk5 avatar Mar 31 '25 13:03 jkirk5

Numpy 2.0 theoretically should now work with Aviary now that Simupy was pulled. We need to test that an environment created with numpy2 will run all tests, and the version limitations on the pyproject.toml will need to be removed

jkirk5 avatar Aug 25 '25 17:08 jkirk5

The testflo output matches using updated versions of numpy and removing simupy. A full list of packages in my conda environment is attached for reference.

CondaEnvironmentNumpy2.docx

nathanperreau avatar Sep 12 '25 21:09 nathanperreau