NVIDIA / modulus-sym

Framework providing pythonic APIs, algorithms and utilities to be used with Modulus core to physics inform model training as well as higher level abstraction for domain experts
https://developer.nvidia.com/modulus
Apache License 2.0
147 stars 60 forks source link

🐛[BUG]: Error on running example ldc_2d #53

Open vnikoofard opened 11 months ago

vnikoofard commented 11 months ago

Version

1.1.0

On which installation method(s) does this occur?

Pip

Describe the issue

I have a clean installation of Modulus and Sym. To check if my installation is working fine I ran the ldc_2d example in the terminal and got the following error

I'm using Pop OS 22.04 running on a machine with RTX 2060.

Minimum reproducible example

python ldc_2d.py

Relevant log output

Traceback (most recent call last):
  File "/home/vahid/Downloads/ldc_2d.py", line 20, in <module>
    import modulus.sym
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/site-packages/modulus/sym/__init__.py", line 21, in <module>
    from .hydra.utils import main, compose
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/site-packages/modulus/sym/hydra/__init__.py", line 15, in <module>
    from .utils import (
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/site-packages/modulus/sym/hydra/utils.py", line 38, in <module>
    from .config import register_modulus_configs, ModulusConfig
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/site-packages/modulus/sym/hydra/config.py", line 34, in <module>
    from .training import TrainingConf, StopCriterionConf
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/site-packages/modulus/sym/hydra/training.py", line 45, in <module>
    @dataclass
     ^^^^^^^^^
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/dataclasses.py", line 1221, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/dataclasses.py", line 1211, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/dataclasses.py", line 959, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vahid/miniconda3/envs/modulus/lib/python3.11/dataclasses.py", line 816, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'modulus.sym.hydra.loss.NTKConf'> for field ntk is not allowed: use default_factory

Environment details

I installed Modulus first and them Modulus-sym. During the installation of Modulus I got an error related to mpi4py. I could resolve it by installing mpi4py via conda instead of pip. During the installation of the Sym module I had difficulties because of Cytohn and Scikit-learn. It wasn't able to install sklearn due to some incompatibility with cython.  I cloned the repo and change the versions of these packages to the latest and after this change I could install the module.

Other/Misc.

No response

pkestene commented 6 months ago

@vnikoofard

I'm facing the exact same problem as you when installing modulus.sym:

Did you by any change find a workaround ?

pkestene commented 6 months ago

@vnikoofard

just for the record, on my side, when downgrading python version from 3.11 to 3.10, pip installing modulus and modulus.sym work fine, and running the examples are ok too.