Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing jax_md #260

Closed
reubenharry opened this issue May 16, 2023 · 0 comments · Fixed by #266
Closed

Error importing jax_md #260

reubenharry opened this issue May 16, 2023 · 0 comments · Fixed by #266

Comments

@reubenharry
Copy link

Thanks for jax_md, it's great!

Recently, I've encountered the following error, after installing jax_md with pip3 install -e . from main:

>>> import jax_md
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/reubencohn-gordon/jax-md/jax_md/__init__.py", line 27, in <module>
    from jax_md import rigid_body
  File "/Users/reubencohn-gordon/jax-md/jax_md/rigid_body.py", line 661, in <module>
    @dataclasses.dataclass
     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/reubencohn-gordon/jax-md/jax_md/dataclasses.py", line 41, in dataclass
    data_clz = dataclasses.dataclass(frozen=True)(clz)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1213, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'jaxlib.xla_extension.ArrayImpl'> for field point_radius is not allowed: use default_factory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant