powsybl / pypowsybl

A PowSyBl and Python integration based on GraalVM native image
Mozilla Public License 2.0
52 stars 10 forks source link

Compatibility with numpy >=2.0.0 #795

Closed sergio-dorado closed 2 weeks ago

sergio-dorado commented 3 weeks ago

Describe the current behavior

An error is being thrown when importing pypowsybl on Windows with Python 3.12 and numpy >= 2.0.0 The issue is bypassed when downgrading numpy to 1.26.4.

The terminal prompt can be seen below.

Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:04:44) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pypowsybl as pp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Sergio\.conda\envs\sd_powsybl\Lib\site-packages\pypowsybl\__init__.py", line 12, in <module>
    from pypowsybl import _pypowsybl, voltage_initializer
  File "C:\Users\Sergio\.conda\envs\sd_powsybl\Lib\site-packages\pypowsybl\voltage_initializer\__init__.py", line 7, in <module>
    from .impl.voltage_initializer import run
  File "C:\Users\Sergio\.conda\envs\sd_powsybl\Lib\site-packages\pypowsybl\voltage_initializer\impl\voltage_initializer.py", line 8, in <module>
    from pypowsybl.network import Network
  File "C:\Users\Sergio\.conda\envs\sd_powsybl\Lib\site-packages\pypowsybl\network\__init__.py", line 9, in <module>
    from .impl.network import (
  File "C:\Users\Sergio\.conda\envs\sd_powsybl\Lib\site-packages\pypowsybl\network\impl\network.py", line 25, in <module>
    from numpy import Inf
ImportError: cannot import name 'Inf' from 'numpy' (C:\Users\Sergio\.conda\envs\sd_powsybl\Lib\site-packages\numpy\__init__.py). Did you mean: 'inf'?

Describe the expected behavior

No response

Describe the steps

No response

Environment

No response

Relevant Log Output

No response

Extra Information

No response

geofjamg commented 2 weeks ago

Already solved by https://github.com/powsybl/pypowsybl/pull/771 and available in next release (planned for this week).