Cannot run the example in bare metal (22.09) "No module named 'modulus.hydra'"

Hello,

I am a beginner in deep learning and PINNs, and I have enjoyed using Modulus in the container. However, I would like to try it on the bare metal as well, so I can use jupyter notebook.

I followed the tutorial to install Modulus on Ubuntu 22.04, but I encountered an error when I ran the helmholtz.py example:

from modulus.hydra import to_absolute_path, instantiate_arch, ModulusConfig ModuleNotFoundError: No module named β€˜modulus.hydra’

I tried to change the version of hydra.core==1.1.1, but it did not help. I am not sure what went wrong during the installation process. Could you please give me some advice or guidance on how to fix this issue?

Thank you very much.

1 Like

Hi @gptkzm

This looks like Modulus was not properly installed fully. modulus.hydra lives in the Modulus package. So I would double check your Modulus install.

Hello,

I have a similar issue using Google Collab. When the code is inside a python file and executed by command:

!python example.py

then it works. When I put the code directly into the notebook, then I have the error:

ModuleNotFoundError: No module named 'modulus.hydra'

There is no error during modulus installation.

Hi @mateusz10

Where did you install from (what repo did you clone)?

I cloned the official repo (I guess):

@gitlab.com/nvidia/modulus/modulus.git

It is the same version number as OP’s.

Finished processing dependencies for modulus==22.9

@mateusz10

This error is because it seems Modulus the package is not completely installed for some reason (not necessarily related to the dependencies). I would check the installation location of the modulus package to see if all the files are there.

Can also check other imports such as from modulus.key import Key works. If this also fails, Modulus is not installed.

Other imports also fail. But what is strange for me is that Modulus works when I execute it from a python file.

I checked the installation location:

/content/modulus/build/lib/modulus - correct me if I am wrong

and get the following structure. Looks like Hydra is in there.

β”œβ”€β”€ constants.py
β”œβ”€β”€ dataset
β”‚   β”œβ”€β”€ continuous.py
β”‚   β”œβ”€β”€ dataset.py
β”‚   β”œβ”€β”€ discrete.py
β”‚   └── __init__.py
β”œβ”€β”€ distributed
β”‚   β”œβ”€β”€ helpers.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── manager.py
β”œβ”€β”€ domain
β”‚   β”œβ”€β”€ constraint
β”‚   β”‚   β”œβ”€β”€ constraint.py
β”‚   β”‚   β”œβ”€β”€ continuous.py
β”‚   β”‚   β”œβ”€β”€ discrete.py
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── utils.py
β”‚   β”œβ”€β”€ domain.py
β”‚   β”œβ”€β”€ inferencer
β”‚   β”‚   β”œβ”€β”€ inferencer.py
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ ov.py
β”‚   β”‚   β”œβ”€β”€ pointwise.py
β”‚   β”‚   β”œβ”€β”€ voxel.py
β”‚   β”‚   └── vtkpointwise.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ monitor
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ monitor.py
β”‚   β”‚   └── pointwise.py
β”‚   └── validator
β”‚       β”œβ”€β”€ continuous.py
β”‚       β”œβ”€β”€ discrete.py
β”‚       β”œβ”€β”€ __init__.py
β”‚       └── validator.py
β”œβ”€β”€ eq
β”‚   β”œβ”€β”€ derivatives.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ mfd
β”‚   β”‚   β”œβ”€β”€ finite_derivatives.py
β”‚   β”‚   β”œβ”€β”€ functions.py
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ non_dim.py
β”‚   β”œβ”€β”€ pde.py
β”‚   └── pdes
β”‚       β”œβ”€β”€ advection_diffusion.py
β”‚       β”œβ”€β”€ basic.py
β”‚       β”œβ”€β”€ diffusion.py
β”‚       β”œβ”€β”€ electromagnetic.py
β”‚       β”œβ”€β”€ energy_equation.py
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ linear_elasticity.py
β”‚       β”œβ”€β”€ navier_stokes.py
β”‚       β”œβ”€β”€ signed_distance_function.py
β”‚       β”œβ”€β”€ turbulence_zero_eq.py
β”‚       └── wave_equation.py
β”œβ”€β”€ geometry
β”‚   β”œβ”€β”€ adf.py
β”‚   β”œβ”€β”€ curve.py
β”‚   β”œβ”€β”€ discrete_geometry.py
β”‚   β”œβ”€β”€ geometry.py
β”‚   β”œβ”€β”€ helper.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ parameterization.py
β”‚   β”œβ”€β”€ primitives_1d.py
β”‚   β”œβ”€β”€ primitives_2d.py
β”‚   β”œβ”€β”€ primitives_3d.py
β”‚   └── tessellation.py
β”œβ”€β”€ graph.py
β”œβ”€β”€ hydra
β”‚   β”œβ”€β”€ arch.py
β”‚   β”œβ”€β”€ callbacks.py
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ graph.py
β”‚   β”œβ”€β”€ help.yaml
β”‚   β”œβ”€β”€ hydra.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ loss.py
β”‚   β”œβ”€β”€ metric.py
β”‚   β”œβ”€β”€ optimizer.py
β”‚   β”œβ”€β”€ pde.py
β”‚   β”œβ”€β”€ profiler.py
β”‚   β”œβ”€β”€ scheduler.py
β”‚   β”œβ”€β”€ training.py
β”‚   └── utils.py
β”œβ”€β”€ __init__.py
β”œβ”€β”€ key.py
β”œβ”€β”€ loss
β”‚   β”œβ”€β”€ aggregator.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── loss.py
β”œβ”€β”€ manager.py
β”œβ”€β”€ models
β”‚   β”œβ”€β”€ afno
β”‚   β”‚   β”œβ”€β”€ afno.py
β”‚   β”‚   β”œβ”€β”€ distributed
β”‚   β”‚   β”‚   β”œβ”€β”€ afno.py
β”‚   β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”‚   β”œβ”€β”€ layers.py
β”‚   β”‚   β”‚   └── mappings.py
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ arch.py
β”‚   β”œβ”€β”€ deeponet.py
β”‚   β”œβ”€β”€ dgm.py
β”‚   β”œβ”€β”€ fno.py
β”‚   β”œβ”€β”€ fourier_net.py
β”‚   β”œβ”€β”€ fully_connected.py
β”‚   β”œβ”€β”€ fused_mlp.py
β”‚   β”œβ”€β”€ hash_encoding_net.py
β”‚   β”œβ”€β”€ highway_fourier_net.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ interpolation.py
β”‚   β”œβ”€β”€ layers
β”‚   β”‚   β”œβ”€β”€ activation.py
β”‚   β”‚   β”œβ”€β”€ dgm_layers.py
β”‚   β”‚   β”œβ”€β”€ fourier_layers.py
β”‚   β”‚   β”œβ”€β”€ fully_connected_layers.py
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ siren_layers.py
β”‚   β”‚   β”œβ”€β”€ spectral_layers.py
β”‚   β”‚   └── weight_norm.py
β”‚   β”œβ”€β”€ modified_fourier_net.py
β”‚   β”œβ”€β”€ moving_time_window.py
β”‚   β”œβ”€β”€ multiplicative_filter_net.py
β”‚   β”œβ”€β”€ multiscale_fourier_net.py
β”‚   β”œβ”€β”€ pix2pix.py
β”‚   β”œβ”€β”€ radial_basis.py
β”‚   β”œβ”€β”€ siren.py
β”‚   β”œβ”€β”€ super_res_net.py
β”‚   └── utils.py
β”œβ”€β”€ node.py
β”œβ”€β”€ solver
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ multidomain.py
β”‚   β”œβ”€β”€ sequential.py
β”‚   └── solver.py
β”œβ”€β”€ test
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ run_tests.py
β”‚   β”œβ”€β”€ test_derivatives.py
β”‚   β”œβ”€β”€ test_geometry.py
β”‚   β”œβ”€β”€ test_graph.py
β”‚   β”œβ”€β”€ test_interpolation.py
β”‚   β”œβ”€β”€ test_loss.py
β”‚   β”œβ”€β”€ test_meshless_finite_dirv.py
β”‚   β”œβ”€β”€ test_models
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ model_test_utils.py
β”‚   β”‚   β”œβ”€β”€ test_activation.py
β”‚   β”‚   β”œβ”€β”€ test_afno.py
β”‚   β”‚   β”œβ”€β”€ test_arch.py
β”‚   β”‚   β”œβ”€β”€ test_deeponet.py
β”‚   β”‚   β”œβ”€β”€ test_dgm.py
β”‚   β”‚   β”œβ”€β”€ test_fno.py
β”‚   β”‚   β”œβ”€β”€ test_fourier_net.py
β”‚   β”‚   β”œβ”€β”€ test_fully_connected.py
β”‚   β”‚   β”œβ”€β”€ test_func_arch.py
β”‚   β”‚   β”œβ”€β”€ test_fused_mlp.py
β”‚   β”‚   β”œβ”€β”€ test_highway_fourier.py
β”‚   β”‚   β”œβ”€β”€ test_modified_fourier.py
β”‚   β”‚   β”œβ”€β”€ test_multiplicative_filter.py
β”‚   β”‚   β”œβ”€β”€ test_multiscale_fourier.py
β”‚   β”‚   β”œβ”€β”€ test_pix2pix.py
β”‚   β”‚   β”œβ”€β”€ test_radial_basis.py
β”‚   β”‚   β”œβ”€β”€ test_siren.py
β”‚   β”‚   └── test_super_res.py
β”‚   β”œβ”€β”€ test_spectral_convs.py
β”‚   β”œβ”€β”€ test_sympy_node.py
β”‚   β”œβ”€β”€ test_sympy_printer.py
β”‚   └── test_tesselated_geometry.py
β”œβ”€β”€ trainer.py
└── utils
    β”œβ”€β”€ benchmark
    β”‚   β”œβ”€β”€ benchmark.py
    β”‚   └── __init__.py
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ io
    β”‚   β”œβ”€β”€ csv_rw.py
    β”‚   β”œβ”€β”€ field.py
    β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”œβ”€β”€ plotter.py
    β”‚   β”œβ”€β”€ time_series.py
    β”‚   └── vtk.py
    β”œβ”€β”€ sympy
    β”‚   β”œβ”€β”€ functions.py
    β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”œβ”€β”€ numpy_printer.py
    β”‚   └── torch_printer.py
    β”œβ”€β”€ training
    β”‚   └── stop_criterion.py
    └── vpinn
        β”œβ”€β”€ __init__.py
        β”œβ”€β”€ integral.py
        └── test_functions.py

26 directories, 168 files

I found the solution, which is restart the Runtime :-)

I have the same issue here.

File β€œhelmholtz.py”, line 4, in
from modulus.hydra import to_absolute_path, instantiate_arch, ModulusConfig
ModuleNotFoundError: No module named β€˜modulus.hydra’

However, when I run python 3.8 and run

from modulus.key import Key

it works.

Any ideas?

@wolkerstorfergloria whats your environment and what version of Modulus are you using?

You have the worst documentation and very hard to install your library very very bad

1 Like

Same here.
I’m trying to install using:

pip install nvidia-modulus nvidia-modulus-launch nvidia-modulus-sym

And I got the same error:

from modulus.hydra import to_absolute_path, ModulusConfig, instantiate_arch
ModuleNotFoundError: No module named 'modulus.hydra'

Please help.