Skip to content

Incompatible with NumPy 2.0 #1364

Description

@njzjz

See the error message below.

    return parmed.load_file(param_file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/formats/registry.py", line 194, in load_file
    return cls.parse(filename, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/amber/amberformat.py", line 353, in parse
    return LoadParm(filename, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/amber/readparm.py", line 48, in LoadParm
    parm = parm.view_as(AmberParm)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/amber/amberformat.py", line 420, in view_as
    return cls.from_rawdata(self)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/amber/_amberparm.py", line 233, in from_rawdata
    inst.initialize_topology()
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/amber/_amberparm.py", line 204, in initialize_topology
    self.box = list(box[1:]) + [box[0], box[0], box[0]]
    ^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/parmed/amber/_amberparm.py", line 2150, in box
    box = np.array(box, dtype=np.float64, copy=False, subok=True).reshape((-1, 6))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions