Skip to content

numpy>=2.4.0 incompatability. TypeError: only 0-dimensional arrays can be converted to Python scalars #279

@maartenboersma

Description

@maartenboersma

Describe the bug
With numpy versions >= 2.4.0, cannot compile any SRAM because of the python exception above.

Version
tag=1.2.48

To Reproduce
Try to compile an SRAM with numpy>=2.4.0. I confirmed that things work with numpy<=2.3.5.

Expected behavior
As specified in requirements.txt, I expect that OpenRAM works with any numpy>=1.17.4.

Logs
Stack trace:

  File "/my/path/OpenRAM/compiler/sram.py", line 58, in __init__
    self.s.create_layout()
  File "/my/path/OpenRAM/compiler/modules/sram_1bank.py", line 217, in create_layout
    self.route_layout()
  File "/my/path/OpenRAM/compiler/modules/sram_1bank.py", line 1072, in route_layout
    init_bbox = self.get_bbox()
                ^^^^^^^^^^^^^^^
  File "/my/path/OpenRAM/compiler/base/hierarchy_layout.py", line 1820, in get_bbox
    ll = vector(boundary[0][0], boundary[0][1])
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my/path/OpenRAM/compiler/base/vector.py", line 29, in __init__
    self.x = float(x)
             ^^^^^^^^
TypeError: only 0-dimensional arrays can be converted to Python scalars

I think the fix is trivial enough for me to do it. I plan to create a PR for it.

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