anuga-community / anuga_core

ANUGA for the simulation of the shallow water equation
https://anuga.anu.edu.au
Other
32 stars 23 forks source link

Error in "import anuga" #50

Closed 9202014710 closed 1 month ago

9202014710 commented 1 month ago

I installed anuga by conda create -n anuga_env python=3.9 anuga mpi4py, successfully installed but fail in using. Here is the error message:

Traceback (most recent call last):
  File "/home/shoudaoz/Documents/anuga_core-main/test_zsd.py", line 1, in <module>
    import anuga
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/__init__.py", line 48, in <module>
    from anuga.shallow_water.shallow_water_domain import Domain
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/shallow_water/shallow_water_domain.py", line 102, in <module>
    from anuga.abstract_2d_finite_volumes.generic_domain \
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/abstract_2d_finite_volumes/generic_domain.py", line 27, in <module>
    from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/abstract_2d_finite_volumes/neighbour_mesh.py", line 10, in <module>
    from .general_mesh import General_mesh
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/abstract_2d_finite_volumes/general_mesh.py", line 7, in <module>
    from anuga.coordinate_transforms.geo_reference import Geo_reference
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/coordinate_transforms/__init__.py", line 3, in <module>
    from .redfearn import *
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/coordinate_transforms/redfearn.py", line 9, in <module>
    from anuga.coordinate_transforms.geo_reference import Geo_reference, DEFAULT_ZONE
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/coordinate_transforms/geo_reference.py", line 14, in <module>
    from anuga.utilities.numerical_tools import ensure_numeric
  File "/home/shoudaoz/Documents/anuga_core-main/anuga/utilities/numerical_tools.py", line 389, in <module>
    from .util_ext import gradient, gradient2
ModuleNotFoundError: No module named 'anuga.utilities.util_ext'

How can I solve the problem?

stoiver commented 1 month ago

I think the problem is due to running your script from the anuga_core directory.

Move your script to another directory and see if it works.

When running from anuga_core python will use the code in anuga_core/anuga which actually hasn't been installed. The conda installed version of anuga has been installed in the appropriate anuga_env site_packages directory.

9202014710 commented 1 month ago

It works, thanks for your help.

(/mnt/md0/shoudaoz/conda_env/anuga) shoudaoz@nwp-r1:~/Documents$ python test.py 
WARNING: Could not import mpi4py - defining sequential interface