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

AttributeError: module 'jax.random' has no attribute 'KeyArray' #298

Closed
Marsolo1 opened this issue Feb 15, 2024 · 1 comment · Fixed by #304
Closed

AttributeError: module 'jax.random' has no attribute 'KeyArray' #298

Marsolo1 opened this issue Feb 15, 2024 · 1 comment · Fixed by #304

Comments

@Marsolo1
Copy link

Hi,

It seems that the depencencies indicated in the setup.pyare broken.

To reproduce the error:

  • Install jax-md in a new virtual environment:
pip install jax-md

Then in a Python interpreter:

from jax_md import rigid_body

Normally you will see the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/martial/vivarium/.venv2/lib/python3.11/site-packages/jax_md/__init__.py", line 27, in <module>
    from jax_md import rigid_body
  File "/Users/martial/vivarium/.venv2/lib/python3.11/site-packages/jax_md/rigid_body.py", line 76, in <module>
    KeyArray = random.KeyArray
               ^^^^^^^^^^^^^^^
  File "/Users/martial/vivarium/.venv2/lib/python3.11/site-packages/jax/_src/deprecations.py", line 53, in getattr
    raise AttributeError(f"module {module!r} has no attribute {name!r}")
AttributeError: module 'jax.random' has no attribute 'KeyArray'

Thanks in advance for the help

@MarcBerneman
Copy link
Contributor

I will take care of this error. For now, I suggest that you use an older version of JAX.

muhrin added a commit to muhrin/jax-md that referenced this issue Mar 24, 2024
In jax 0.4.24 they removed KeyArray from jax.random (see
https://jax.readthedocs.io/en/latest/changelog.html#jax-0-4-24-feb-6-2024),
the advice is now to just use jax.Array instead.
@muhrin muhrin mentioned this issue Mar 24, 2024
ekindogus added a commit that referenced this issue Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants