anuga-community / anuga_core

ANUGA for the simulation of the shallow water equation

Home Page:https://anuga.anu.edu.au

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No module named 'numpy.lib.arraysetops'

wwh037 opened this issue · comments

(anuga_env) [wwh@wwh simple_examples]$ python runup.py
Traceback (most recent call last):
  File "/home/wwh/Documents/anuga_core/examples/simple_examples/runup.py", line 10, in <module>
    import anuga
  File "/home/wwh/miniforge3/envs/anuga_env/lib/python3.9/site-packages/anuga/__init__.py", line 110, in <module>
    from anuga.parallel.parallel_api import distribute
  File "/home/wwh/miniforge3/envs/anuga_env/lib/python3.9/site-packages/anuga/parallel/__init__.py", line 15, in <module>
    from .parallel_api import distribute
  File "/home/wwh/miniforge3/envs/anuga_env/lib/python3.9/site-packages/anuga/parallel/parallel_api.py", line 16, in <module>
    from anuga.parallel.sequential_distribute import sequential_distribute_dump
  File "/home/wwh/miniforge3/envs/anuga_env/lib/python3.9/site-packages/anuga/parallel/sequential_distribute.py", line 10, in <module>
    from anuga.parallel.distribute_mesh  import send_submesh
  File "/home/wwh/miniforge3/envs/anuga_env/lib/python3.9/site-packages/anuga/parallel/distribute_mesh.py", line 30, in <module>
    import numpy.lib.arraysetops as numset
ModuleNotFoundError: No module named 'numpy.lib.arraysetops'
(anuga_env) [wwh@wwh simple_examples]$ pip list | grep numpy
numpy               2.0.0

@wwh037 looks like a problem with numpy 2.0.0 I can see various errors popping up online, but not ours specifically. I did search for arraysetops in the numpy 2.0 manual and didn't find any reference to it. Looks like the files in numpy.lib have been overhauled and changed the access to arraysetops.
.
I suggest for the time being, revert to numpy version 1.26

@wwh037 With numpy 2.0 the procedures we use from numpy.lib.arraysetops have been moved to numpy. We will make a change in the develop branch of anuga_core and the next release 3.2.

@wwh037 I have tried to fix the problem in the develop branch of anuga_core. I haven't tried the fix with numpy 2.0. Would be great if you could download the updated version and see if it works. In the meantime I will have to update our CI test to use numpy 2.0.

@wwh037 Seems there are other changes with numpy 2.0. So for the time being I would recommend reverting back to numpy 1.26

@wwh037 I only had to change one instance of np.array(obj, copy=False) to npasarray(obj) and that allowed ANUGA to pass all the unittests using numpy 2.0. The correction is in the latest version of the develop branch of anuga_core on this site.