modulus-sym icon indicating copy to clipboard operation
modulus-sym copied to clipboard

🐛[BUG]: Error on running example ldc_2d

Open vnikoofard opened this issue 2 years ago • 2 comments

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

vnikoofard avatar Aug 23 '23 00:08 vnikoofard

@vnikoofard

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

  • incompatibility between cython and scikit-learn
  • installing manually a more recent version of scikit-learn makes modulus-sym installation ok
  • but then any application/example fails with the exact same error message as the one above

Did you by any change find a workaround ?

pkestene avatar Jan 04 '24 15:01 pkestene

@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.

pkestene avatar Jan 04 '24 16:01 pkestene

Hi @vnikoofard ,

Could you please verify if this issue still occurs with PhysicsNeMo latest release? If you're still experiencing the issue, please let us know and share the environment details/scenario. Otherwise, we can close this ticket.

Thanks for your help!

abokov-nv avatar Apr 15 '25 22:04 abokov-nv