user7954302
user7954302

Reputation: 41

Cannot import name 'isin' Python with JAX

I wanted to make a deep learning model to run on my PC, but while it’s downloading it stops, because of the error message cannot import name 'isin' from 'jax._src.numpy.lax_numpy'

I have numpy and jax installed but it still gives me this error message. Is there any package I missed.(and some more)

EDIT: The dalle-flow-server https://github.com/jina-ai/dalle-flow and after writing jina flow --uses flow.yml it tries to execute a file and download a pre trained model and while it's doing that --> the Error appears.

Upvotes: 2

Views: 2824

Answers (2)

joel
joel

Reputation: 7868

Try re-running pip install -r requirements.txt. It looks like it might not have completed successfully

Upvotes: 0

jakevdp
jakevdp

Reputation: 86328

The version 0.3.5 release of JAX rearranged some of the private implementation, and isin is no longer part of the private jax._src.numpy.lax_numpy submodule.

Regardless of which JAX version you are using, the recommended import is

from jax.numpy import isin

This will work correctly in any JAX version released in the last several years since the isin function was first added.

In general, you should avoid imports from any private submodule like jax._src.numpy (i.e. those starting with an underscore) because the contents may be subject to change in any release without warning. For public submodules like jax.numpy, any such changes will come with deprecation warnings for several releases before the imports are moved. See JAX's API Compatibility Policy for more information.

If you are using a third party package that depends on private submodule imports, you may need to pin a particular jax & jaxlib version for it to work correctly. In this case it looks like you'll need the following:

$ pip install jax==0.3.4 jaxlib==0.3.2

You may wish to report this issue to the maintainers of dalle-flow, and suggest that they no longer rely on imports from private submodules.

Upvotes: 2

Related Questions