3MAH / microgen

Microstructure generation
https://3mah.github.io
GNU General Public License v3.0
67 stars 8 forks source link

Issue with numpy 2.0.0 #81

Closed dvd101x closed 4 months ago

dvd101x commented 4 months ago

Describe the bug, what's wrong, and what you expected.

Hi, thanks for this library, I'm just starting but I think I found a bug.

I tested installing microgen in a new virtual environment and follow some of the examples on the home page.

Nothing works, even:

import microgen
print(microgen.Report())

Generates an error showing.

AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

The issue is resolved by downgrading to numpy 1.26.4

Just to be clear, I did make a new virtual environment and only installed microgen, by default it installed numpy 2.0.0 and had to downgrade manually to 1.26.4

I also tested outside the virtual environment with the same results.

Steps to reproduce the bug.

from microgen import Tpms
from microgen.shape.surface_functions import gyroid

geometry = Tpms(
    surface_function=gyroid,
    density=0.30,
    resolution=30,
)
shape = geometry.generateVtk(type_part="sheet")
shape.save("gyroid.stl")

System Information

AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

If I revert to numpy 1.26.4 then the issue is fixed and it shows the following

--------------------------------------------------------------------------------
  Date: Thu Jul 04 11:17:47 2024 Central Standard Time (Mexico)

                OS : Windows (11 10.0.22631 SP0 Multiprocessor Free)
            CPU(s) : 20
           Machine : AMD64
      Architecture : 64bit
       Environment : Python

  Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64
  bit (AMD64)]

           pyvista : 0.43.10
               vtk : 9.3.1
             numpy : 1.26.4
            scooby : 0.10.0
              gmsh : 4.13.1
          cadquery : 2.4.0
        matplotlib : 3.9.1
            meshio : 5.3.5

Screenshots

No response

kmarchais commented 4 months ago

Hello, thanks a lot for reporting this issue. It was fixed on the main branch but we had not released a new version. I am preparing it now.

kmarchais commented 4 months ago

Version 1.2.1 is now available with pip install microgen --upgrade and will be available shortly on conda-forge.

Numpy 2.0 is not supported yet. This fix, only changes the numpy version installed (<2) when microgen is installed.

dvd101x commented 4 months ago

Thanks!