Skip to content

Import problem with Numpy2.0.1 #281

Open

Description

@Qooniee

Version Information

  • Numpy version: 2.0.1
  • Python version: 3.10.3
  • python obd version: 0.7.2

Problem Details

An error occurs when importing the obd module:
AttributeError: module 'numpy' has no attribute 'cumproduct'

Expected Behavior

The obd module should import without errors.

Actual Behavior

An AttributeError occurs, indicating that the cumproduct function does not exist in the current version of numpy.

When I use numpy==1.26.4, I can import obd because numpy has np.cumproduct.
You can replace np.cumproduct with np.cumprod.

Activity

  1. Lauwy222 commented on Aug 20, 2024

    @Lauwy222

    got the same issue

  2. theaircrasher commented on Sep 3, 2024

    @theaircrasher

    Same problem here with:

    Python 3.10.12
    numpy 2.1.0
    obd 0.7.2

  3. Derek-Shannon commented on Sep 16, 2024

    @Derek-Shannon

    Fixed the Problem!

    Python 3.11.9
    obd 0.7.2
    numpy 2.0.1

    Go to C:\Users{YOUR-USER}\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pint\facets\numpy\numpy_func.py

    Replace line 884 with:
    for func_str in ["cumprod", "nancumprod"]:

  4. davrandom commented on Nov 15, 2024

    @davrandom

    It is fixed in more recent versions of pint [1].
    We just need to bump the requirements in python_OBD.
    If you change setup.py and require pint>=0.24.4, build and install, it works fine (uninstall old pint first).

    [1] https://pypi.org/project/Pint/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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